I have a problem with ag-grid, I am getting in the console this warning, I did some research but none of them solve my problem, and I don't know what is wrong with my code, from angular material I understood was a memory leak in mine application, but I don't get it.
ag-Grid: tried to call sizeColumnsToFit() but the grid is coming back with zero width, maybe the grid is not visible yet on the screen?
Please,
if you have an idea how to fix, or if something is wrong in my code I would really appreciate even the smallest help.
What I tried :
@HostListener('window:resize')
onResize() {
if (!this.gridApi) return;
setTimeout(() => {
this.gridApi.sizeColumnsToFit();
});
}
this one :
afterGridReady() {
if (this.language === 'en') {
this.appgrid.columnApi.setColumnsVisible(['name'], true);
this.appgrid.columnApi.setColumnsVisible(['nameCZ'], false);
} else {
this.appgrid.columnApi.setColumnsVisible(['nameCZ'], true);
this.appgrid.columnApi.setColumnsVisible(['name'], false);
}
this.api.sizeColumnsToFit();
window.addEventListener('resize', function () {
setTimeout(function () {
this.api.sizeColumnsToFit();
});
});
}
Thank you in advance.