Search code examples
ag-gridag-grid-react

How to display empty message like "No Data Found" when using AG Grid Server Side Row Model


title says it all.

I have been using AG Grid with Server Side Row Model.

I have go through their documentation but I was not able to find a way to handle empty data.

Anyone have came across this problem and how to did you implement it?

Thanks.


Solution

  • When you're using server-side row model you can utilize two overlays that AG Grid supplies. The first is the loading overlay, and the second, the one I think you want, is no rows overlay.

    For example in the datasource before calling params.success() or params.fail() you can check if your row data is empty and hide/show the overlay like in the following example:

    rowData.length ? params.api.hideOverlay() : params.api.showNoRowsOverlay();
    

    It is also possible to supply a custom overlay component