简体   繁体   English

AG-GRID Excel 导出:AG-Grid 中是否有任何方法可以配置每个用户的记录导出限制?

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

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.有什么方法可以限制 AG-Grid 的 Excel 导出限制,以便用户只能导出允许的行数。

For an Example, if Grid is showing 75,000 Records, can we limit Excel to export only 10,000 (or any configurable number) records ?例如,如果 Grid 显示 75,000 条记录,我们是否可以限制 Excel 仅导出 10,000(或任何可配置数量)记录?

Not per configuration, no.不是每个配置,不是。 But you can implement this functionality yourself as one of the exportparams for但是你可以自己实现这个功能作为 exportparams 之一

gridOptions.api.exportDataAsExcel(exportParams);

is a callback function shouldRowBeSkipped .是一个回调函数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/查看所有导出参数: https : //www.ag-grid.com/javascript-grid-export/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM