I'm storing the column widths of my ngx-datatable inside a database. I get these values using an AJAX call.
How can I set these values for the datatable?
What I've tried:
- setting the [width] property on the
<ngx-datatable-column>
element - injecting the datatable as
@ViewChild(DatatableComponent) table: DatatableComponent;
and settingthis.table.bodyComponent.columns[0].width = 500;
I've tried these methods with and withoutthis.table.recalculate();
, but nothing seems to work.
EDIT
I'm using datatable-column
with header-template
and cell-template
.
ngIf
approach like this:*ngIf="gridData$ | async"
- the grid is not rendered untill row data received. The problem is that the grid is not displayed (including progressbar and headers) till data is loaded. And it does not look nice. – Photon