Ag-grid 详细信息网格中的无限滚动
Infinite Scroll in Ag-grid Details Grid
如何在详细信息网格中设置无限scroll/Pagination。我正在为 master 使用服务器端模型,并希望为细节使用无限模型。如何使用无限滚动行 Data
设置详细信息网格 detailCellRendererParams
在 detailGridOptions
中定义无限行模型类型及其属性:
detailGridOptions: {
...
rowModelType: 'infinite',
// enable pagination
pagination: true,
// fetch 15 rows per at a time
cacheBlockSize: 15,
// display 10 lines per page
paginationPageSize: 10,
// how many rows to seek ahead when unknown data size.
cacheOverflowSize: 2,
// how many concurrent data requests are allowed.
// default is 2, so server is only ever hit with 2 concurrent requests.
maxConcurrentDatasourceRequests: 2,
// how many rows to initially allow scrolling to in the grid.
infiniteInitialRowCount: 1,
// how many pages to hold in the cache.
maxBlocksInCache: 2
}
infiniteDatasource
提供了检索详细信息部分数据的方法:
getDetailRowData: (params) => {
//Get grid api regarding current row
var detailGrid = gridOptions.api.getDetailGridInfo(params.node.id);
//Simulation of server
var server = new FakeServer(params.data.callRecords);
//Preparation of data
var datasource = new infiniteDatasource(server, params);
detailGrid.api.setDatasource(datasource);
}
请注意关于文档:
If you are an enterprise user you should consider using the Server-side row model instead of the infinite row model. It offers the same functionality with many more features.
服务器端行模型的设置应该类似于Infinite one。
如何在详细信息网格中设置无限scroll/Pagination。我正在为 master 使用服务器端模型,并希望为细节使用无限模型。如何使用无限滚动行 Data
设置详细信息网格 detailCellRendererParams在 detailGridOptions
中定义无限行模型类型及其属性:
detailGridOptions: {
...
rowModelType: 'infinite',
// enable pagination
pagination: true,
// fetch 15 rows per at a time
cacheBlockSize: 15,
// display 10 lines per page
paginationPageSize: 10,
// how many rows to seek ahead when unknown data size.
cacheOverflowSize: 2,
// how many concurrent data requests are allowed.
// default is 2, so server is only ever hit with 2 concurrent requests.
maxConcurrentDatasourceRequests: 2,
// how many rows to initially allow scrolling to in the grid.
infiniteInitialRowCount: 1,
// how many pages to hold in the cache.
maxBlocksInCache: 2
}
infiniteDatasource
提供了检索详细信息部分数据的方法:
getDetailRowData: (params) => {
//Get grid api regarding current row
var detailGrid = gridOptions.api.getDetailGridInfo(params.node.id);
//Simulation of server
var server = new FakeServer(params.data.callRecords);
//Preparation of data
var datasource = new infiniteDatasource(server, params);
detailGrid.api.setDatasource(datasource);
}
请注意关于文档:
If you are an enterprise user you should consider using the Server-side row model instead of the infinite row model. It offers the same functionality with many more features.
服务器端行模型的设置应该类似于Infinite one。