AngularJs Kendo Grid初始化时的负载排序

时间:2016-12-01 22:23:28

标签: angularjs kendo-ui kendo-grid

我有一个剑道网格" GridProjects" (参见附件:部分HTML)。在初始化时,在gridHelperService上从我的BD检索列集(名称,字段,...)和排序列列表。

要更新列集,我使用了属性" k-columns"在我的HTML上。但是,由于排序属性在数据源内,因此我无法对排序列执行相同的操作。

我知道我可以使用k-data-source,但在我的情况下,它不起作用,因为我的dataSource传输和过滤器与控制器上的一些变量绑定。

每件事都在这个附件中解释:Projects Kendo Grid

我无法弄清楚如何解决这个问题,如果有人能给我一个打击,我会很感激。

谢谢!

2 个答案:

答案 0 :(得分:0)

I don't know much about your setup but based upon the image. Here is what you can try where you want the sort to happen. I don't know the columns your setup has but if you have firstName I would do sort like this.

 $scope.GridProjects.dataSource.sort({field: "FirstName", dir: "asc"});

Inside the $scope you can get access to the kendo-grid="GridProjects" and then its dataSource and then sort it.

答案 1 :(得分:0)

我的问题是我的网格创建后加载了我的设置(列)。

我在加载设置后更改了代码以创建网格。为此,我调用了我的函数,它在我的回调函数(onSuccess)上创建了网格。