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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26634063/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-22 23:09:36  来源:igfitidea点击:

How to use refresh method in ui-grid?

javascriptangularjsangular-ui-grid

提问by orikoko

I am trying to update visibility option in the columDefs of my ui-grid. After updating the value I need to refresh my ui-grid. What is the way to refresh my grid from my controller?

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

回答by Jose

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!

希望有帮助!

回答by Zdzislaw Kochanski

Depending on your need you can change the following ui-grid option

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

enableRowHashing:false

enableRowHashing:false