AG-GRID Excel Export: Is there any way in AG-Grid to configure Records Export Limit per user?

1.3k Views Asked by At

Is there any way to to restrict Excel Export limit from AG-Grid, so that only allowed number of rows can be exported by a User.

For an Example, if Grid is showing 75,000 Records, can we limit Excel to export only 10,000 (or any configurable number) records ?

1

There are 1 best solutions below

0
On BEST ANSWER

Not per configuration, no. But you can implement this functionality yourself as one of the exportparams for

gridOptions.api.exportDataAsExcel(exportParams);

is a callback function shouldRowBeSkipped.

So a possible implementation would look something like this (not tested):

var exportedRows = 0;

var exportParams = {
  shouldRowBeSkipped: function(params) {
    exportedRows++;
    return exportedRows <= 10000;
  }
};

gridOptions.api.exportDataAsExcel(exportParams);

Have a look at all the export params: https://www.ag-grid.com/javascript-grid-export/