I think you want to display NoRowsOverlay
when there is not records in the grid.
Check this plunk I created: ag-grid Custom Overlay Components - when there are no rows to display.
Open this Plunk and try to filter first column with zzz
string. You'll see it functioning when there are no records in the grid.
How:
One way (of the many - I assume) is to do this is inside onModelUpdated
event of ag-grid.
When this event is fired, check whether are there any rowsToDisplay
in the grid or not. Depending on that, you can decide if you want to display overlay or not.
onModelUpdated($event){
if(this.gridApi && this.gridApi.rowModel.rowsToDisplay.length == 0) {
this.gridApi.showNoRowsOverlay();
}
if(this.gridApi && this.gridApi.rowModel.rowsToDisplay.length > 0) {
this.gridApi.hideOverlay();
}
}