I am experiencing strange behavior where if I set a filter model in the onGridReady event it is deleted afterwords. I've been logging the filterChanged events and I see it being called when i set the filter but it is never being called again yet the filter is cleared without a filter changed event. when I was using community I didn't experience this but when i upgraded to enterprise and started using the setFilter this began happening. any ideas?
onGridReady(params: ICellRendererParams): void {
this.gridApi = params.api
this.gridApi.sizeColumnsToFit()
this.resetDefaults()
window.addEventListener('resize', function() {
setTimeout(function() {
params.api.sizeColumnsToFit()
})
})
}
resetDefaults(): void {
this.gridApi.setFilterModel({
ColorStatus: {
filterType: 'set',
values: [ColorStatus.red.toString(), ColorStatus.yellow.toString()]
}
})
this.gridApi.onFilterChanged(); //I've tried with and without this line
}
Oddly when I set sorting in onGridReady the sort model is not affected only the filter models get cleared. In the mean time I've moved resetDefaults() to the onFirstDataRendered event but this is not ideal because the user will see all data for a moment then before it gets filtered.
My coworker found that adding newRowsAction: 'keep'
to the filterParams of the column in question resolves the issue