27

我正在尝试更新我的 ui-grid 的 columDefs 中的可见性选项。更新值后,我需要刷新我的 ui-grid。从控制器刷新网格的方法是什么?

4

3 回答 3

39

访问此页面:

http://ui-grid.info/docs/#/api/ui.grid.class:GridApi

在实例化你的 gridApi 之后,你可以调用:

//instantiate (not so obvious)
// whatever scope attribute your binding to gridOptions
$scope.gridOptions = {
  onRegisterApi: function(gridApi){ $scope.gridApi = gridApi;}
}
//then later
$scope.gridApi.core.refresh();

希望有帮助!

于 2015-02-13T19:21:44.270 回答
8

根据您的需要,您可以更改以下 ui-grid 选项

enableRowHashing:false

于 2016-05-25T17:03:14.477 回答
0

您可以使用 $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN); 修改列 defs 然后重新刷新网格后的方法。

有关http://ui-grid.info/docs/#!/api/ui.grid.service:uiGridConstants#properties_datachange的更多详细信息

于 2020-06-24T10:47:39.570 回答