bug: sometimes grid column goes into one
See original GitHub issueHello!
Sorry again, I am opening this issue again, that 1 grid issue getting more buggy. We are seeing this problem so frequently, I would like to know source of this problem and I hope to help you to figure out this together.
- Sometimes grid gets lost its column count to 1 and never get recovered until I refresh the page https://drive.google.com/open?id=15m5UkzDATY_GLsPpZ0_Zw8IYOEc-ZD-4
Here goes my implementation
<ngx-masonry class="my-50" [options]="{gutter: gutter}" (layoutComplete)="layoutCompleted($event)">
<div ngxMasonryItem class="masonry-item" *ngFor="let idea of ideas"
[style.width]="cardWidth"
[style.margin-bottom.px]="gutter">
<job-hub-idea-board-card [editable]="editable"
[selectable]="selectable"
[clickable]="clickable"
[idea]="idea"
[isCustomer]="isCustomer"
(view)="view($event)"
(edit)="edit.emit($event)"
(delete)="delete.emit($event)"></job-hub-idea-board-card>
</div>
</ngx-masonry>
<p class="d-flex align-items-center justify-content-center text-primary" *ngIf="hasPending">Loading
{{ ideas.length > loaded ? ideas.length - loaded : loaded - ideas.length }} more images...
<span class="d-inline-block ml-10 px-10 py-10 position-relative"><job-hub-spinner diameter="20"></job-hub-spinner></span>
</p>
export class IdeaBoardComponent implements OnInit {
@Input() ideas: Idea[] = [];
@Input() gutter = 20;
@Input() col = 4;
@ViewChild(NgxMasonryComponent) masonry: NgxMasonryComponent;
loaded = 0;
cardWidth;
get hasPending(): boolean {
return this.ideas.length > 0 && Boolean(this.loaded < this.ideas.length);
}
constructor(
private sanitizer: DomSanitizer
) { }
ngOnInit(): void {
this.cardWidth = this.sanitizer.bypassSecurityTrustStyle(`calc((100% - ${(this.col - 1) * this.gutter}px) / ${this.col}`);
}
layoutCompleted(e) {
if (this.loaded > this.ideas.length) {
this.loaded = this.ideas.length;
return;
}
if (e && e.length === 1) {
this.loaded++;
}
}
reset() {
this.masonry.reloadItems();
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
grid-column doesn't work? [duplicate]
Your problem is that your grid is the 'main' element and 'download_desc' is within the 'download' section tag. Try moving:
Read more >CSS Grid Gotchas And Stumbling Blocks
A true grid is two-dimensional. The two dimensions are rows and columns, and with grid layout you can control both at once. With...
Read more >Bug with sorting columns in grid with detail template
If you have a nested template, it becomes impossible to customize the column sorting and you have to disable sorting for the entire...
Read more >Auto-placement in grid layout - CSS: Cascading Style Sheets
In my example I am allowing auto-placement to place the items, however I have classes that start a dt in column 1, and...
Read more >ERROR while exporting grid data to excel
and I have the below code, and which is containing a grid and the data getting loaded based on the "Status" dropdown selection....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the native masonry functions and options may help - https://masonry.desandro.com/options.html
If you can put a simplified version on stackblitz I could help you debug it.
Actually calling those two functions is maybe resolving that 1 column issue but grid is completely messy. I am trying some other methods on it.