简体   繁体   English

如何在 ui-grid 中使用刷新方法?

[英]How to use refresh method in ui-grid?

I am trying to update visibility option in the columDefs of my ui-grid.我正在尝试更新我的 ui-grid 的 columDefs 中的可见性选项。 After updating the value I need to refresh my ui-grid.更新值后,我需要刷新我的 ui-grid。 What is the way to refresh my grid from my controller?从控制器刷新网格的方法是什么?

Visit this pages:访问此页面:

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

After having instantiated your gridApi, you can just call:实例化 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();

Hope that helps!希望有帮助!

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

enableRowHashing:false

You can use $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN);您可以使用 $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN); method after you modify the column defs and then refesh the grid .修改列 defs 然后刷新网格后的方法。

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

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

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