我正在使用 angular slickgrid 来显示我的数据。我持续监控数据。如果服务器端发生任何更改,则该数据需要在应用程序中更新。这样修改后的数据就会通过这段代码在 slickgrid 中更新this.angularGrid.gridService.updateDataGridItem(data);
。在更新数据时,角度 slickgrid 会多次完全渲染。我想避免多次渲染角度光滑网格。
当前行为
在添加或更新记录时,角度 slickgrid 会多次呈现
期待行为
在添加或更新记录时,角度 slickgrid 只需要更新特定的行数据视图
在这里,我分享了我的网格选项供您参考。
public gridOptions: GridOption = {
enablePagination: true,
autoEdit: false,
enableCellNavigation: true,
editable: true,
enableAutoResize: true,
enableSorting: true,
enableFiltering: true,
enableExcelExport: true,
enableExport: true,
i18n: this.translateService,
gridMenu: {
hideExportExcelCommand: true,
hideExportCsvCommand: true,
customItems: [{
command: "cspfm-excel-export",
titleKey: "EXPORT_TO_EXCEL",
iconCssClass: "fa fa-file-excel-o",
action: (event, callbackArgs) => {
this.excelExport(event, callbackArgs)
}
}, {
command: "cspfm-csv-export",
titleKey: "EXPORT_TO_CSV",
iconCssClass: "fa fa-download",
action: (event, callbackArgs) => {
this.excelExport(event, callbackArgs)
}
}],
},
enableAutoTooltip: true,
autoTooltipOptions: {
enableForCells: true,
enableForHeaderCells: true,
maxToolTipLength: 1000
},
headerMenu: {
hideColumnHideCommand: true
},
autoResize: {
containerId: this.gridContainerId,
calculateAvailableSizeBy: 'container'
},
exportOptions: {
exportWithFormatter: true
},
excelExportOptions: {
exportWithFormatter: true,
},
enableTranslate: true,
presets: {
sorters: [{ columnId: this.tableColumnInfo['pfm138993_institutename']['prop'], direction: 'ASC' }],
},
enableAsyncPostRender: true, // for the Angular PostRenderer, don't forget to enable it
asyncPostRenderDelay: 0, // also make sure to remove any delay to render it
params: {
angularUtilService: this.angularUtilService // provide the service to all at once (Editor, Filter, AsyncPostRender)
},
checkboxSelector: {
// you can toggle these 2 properties to show the "select all" checkbox in different location
hideInFilterHeaderRow: false,
},
rowSelectionOptions: {
// True (Single Selection), False (Multiple Selections)
selectActiveRow: false,
},
enableCheckboxSelector: true,
enableRowSelection: true
};
软件版本
角度:7.3.5
Angular-Slickgrid:2.19.0
打字稿:3.1.6
操作系统:Windows 10
节点:10.16.3
NPM:6.9.0