angularjs - 带角度 ui-grid 的大数据(特征分组选择)
问题描述
这是我的演示插件: http ://plnkr.co/edit/Oqd1WHow01ssu43e
我正在尝试提高网格的性能以实现自定义聚合功能
自定义聚合功能,在我的代码中,我已注册通rowSelectionChanged
知网格以更新数据
onRegisterApi: function( gridApi ) {
$scope.gridApi = gridApi;
function updateGrid(option) {
switch (option) {
case 'column':
$scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN);
break;
case 'row':
$scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.ROW);
break;
case 'edit':
$scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.EDIT);
break;
case 'options':
$scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS);
break;
default:
$scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.ALL);
}
}
$scope.debounceUpdateGrid =_.debounce(()=>updateGrid('column'),100);
gridApi.selection.on.rowSelectionChanged($scope, function (row) {
$scope.debounceUpdateGrid();
});
gridApi.selection.on.rowSelectionChangedBatch($scope, function (row) {
updateGrid('column');
});
}
当我检查 selectAll 标题时,网格只运行一次
gridApi.selection.on.rowSelectionChangedBatch($scope, function (row) {
updateGrid('column');
});
如果我检查组标题以选择所有子行,则网格将围绕子行的长度时间运行
gridApi.selection.on.rowSelectionChanged($scope, function (row) {
$scope.debounceUpdateGrid();
// here debouceUpdate will prevent $scope.gridApi.core.notifyDataChange from being called many tiems which will be more costy or if there's other way for notify grid to update data (custom aggregation result/ selected rows's sum)
});
当我检查父组标题以选择数百个子行时,有没有办法提高网格性能?
预先感谢:)
解决方案
我找到了解决方案,这里是demo
,
推荐阅读
- azure-storage - 按计划删除 Azure 存储中的所有文件
- android - Android 键盘未显示(不适用于任何应用程序)
- asp.net-core - AKKA.NET:可以在多个正在运行的应用程序上创建唯一的演员吗?
- neural-network - 用于识别 0 到 20 的语音数字的深度神经网络
- bash - Makefile 中的 ${foobar} 和 $(foobar) 有什么区别?
- pyspark - 如何在 EMR 笔记本中安装 .jar 依赖项?
- python - 获取此 POST 方法 json API 结果的正确方法是什么?
- testing - 在 Katalon Studio 移动测试中,我在定位一个元素“org.openqa.selenium.InvalidSelectorException”时遇到了这个错误
- javascript - 选择前端元素后从数据库中获取对应的值
- powerbi - if 语句之间的 DAX 日期