不能动态地选择列后刷新数据网格 [英] Not able to refresh the data grid after selecting the column dynamically
问题描述
我刚开始与剑道UI网格,我可以能够做出如何与angularJS剑道集成。
I am just started with kendo UI grids, And I could able to make out how to integrate the kendo with angularJS.
但我想实现像动态添加/选择或取消选择列名,然后将数据网格应该在数据表中显示相应列的一些事情。
But I was trying to implement some thing like dynamically adding/selecting or unselecting the column names, then the data grid should display the columns accordingly in the data table.
现在,当我在网格的右侧选择一个新的专栏中,数据表与所选列更新
Now when I selecting a new column in the right side of the grid, The datatable is updated with that selected column
希望这一形象给出了什么,我指着一个清晰的思路。
Hope this image gives a clear idea on what I am pointing
所以,我要实现这种动态数据网格,
So, I want to achieve this kind of dynamic data grid,
我试过实现一个样本,在的jsfiddle 。在此的jsfiddle你可以找到DataGrid中有一列,但是,当你选择一个复选框,在DataGrid上面选择一列,然后可能无法重新加载/刷新数据网格。
I tried the to implement a sample, in Jsfiddle . In this jsfiddle you can find the datagrid with one column but, when you select a column by selecting a checkbox, above the datagrid, then could not able to reload/refresh the datagrid.
//vm.gridOptions.refresh(); THIS SAYS ERROR
ERROR:
TypeError: vm.gridOptions.refresh is not a function
at vm.addColumsn (
请注意:请考虑列名是从API牵强,所以我需要基于API来实现动态
NOTE: Please Consider the columns names are fetched from API, so I need to implement dynamically based on API
推荐答案
事实上选项没有刷新方法。这是剑道UI部件的方法这不会帮助你实现你的目标。
Indeed the options doesn't have a refresh method. This is a method of the Kendo UI widget which won't help you achieve your goal.
您需要使用K-重新绑定指令,以便在运行时设置选项:
You need to use the k-rebind directive in order to set options at runtime:
<剑道网K-选项=vm.gridOptionsK-重新绑定=vm.gridOptions>< /剑道网>
下面是现场演示: http://jsfiddle.net/btjgzkup/34/
这篇关于不能动态地选择列后刷新数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!