Open belyan opened 2 years ago
One of possible workaround is to add some delay after opening modal, but before displaying datagrid:
openModal() {
this.showModal = true;
setTimeout(() => this.showDataGrid = true);
}
Another workaround is to run detect changes after opening modal, but before displaying datagrid:
openModal() {
this.showModal = true;
this.changeDetectorRef.detectChanges();
this.showDataGrid = true;
}
Hello @belyan,
The column sizing lifecycle is a bit complicated and we've seen some problems when a datagrid is inside a container that can be invisible at time of component initialization.
Historically, just *ngIf
-ing the datagrid has been enough, so it can get initialized after its container is visible.
Especially for column sizing issues, the ClrDatagrid exposes a resize()
method. You can also try using it.
Btw, I played with your second stackblitz and for me it works fine without the forced change detection.
Describe the bug
Datagrid inside modal has incorrect initial width of columns equal to zero.
How to reproduce
https://stackblitz.com/edit/clarity-light-theme-clr12-cds5-fherup?file=src/app/app.component.ts
Open modal and check columns width using browser DevTools.
Expected behavior
Width of columns should be correct.
Versions
Clarity version:
Framework:
Framework version:
Device:
Additional notes
Related Issue https://github.com/vmware/clarity/issues/3273