admin管理员组文章数量:1356011
I am trying to set the filter and sort parameters and update my grid in one go instead of two separate calls such as:
grid.dataSource.filter({
field: 'branchId',
operator: 'eq',
value: selectedBranchId
});
grid.dataSource.sort({
field: 'id',
dir: 'desc'
});
I have tried:
grid.dataSource.data({
filter: {
field: 'branchId',
operator: 'eq',
value: selectedBranchId
},
sort: {
field: 'id',
dir: 'desc'
}
})
grid.dataSource.read();
grid.refresh();
Which does not work and gives me the following error in console:
Uncaught TypeError: Cannot read property 'slice' of null in kendo.all.min.js:13
I am trying to set the filter and sort parameters and update my grid in one go instead of two separate calls such as:
grid.dataSource.filter({
field: 'branchId',
operator: 'eq',
value: selectedBranchId
});
grid.dataSource.sort({
field: 'id',
dir: 'desc'
});
I have tried:
grid.dataSource.data({
filter: {
field: 'branchId',
operator: 'eq',
value: selectedBranchId
},
sort: {
field: 'id',
dir: 'desc'
}
})
grid.dataSource.read();
grid.refresh();
Which does not work and gives me the following error in console:
Uncaught TypeError: Cannot read property 'slice' of null in kendo.all.min.js:13
Share
Improve this question
asked Feb 25, 2013 at 12:52
imperium2335imperium2335
24.2k38 gold badges116 silver badges194 bronze badges
2 Answers
Reset to default 5To bine several operations into one use the query method.
query is what you need.
Another workaround is set filter and sorting indirectly and then call fetch method when needed:
dataSource._filter = yourFilter;
dataSource._sort = yourSort;
dataSource.fetch();
second case may be useful when your dataSource already contains query settings like page, take, skip. They will be overwrited by query method, but keeps the same via setting filter/ sorting indirectly.
本文标签: javascriptKendoUI Grid alter filter and sort in one refreshStack Overflow
版权声明:本文标题:javascript - KendoUI Grid alter filter and sort in one refresh - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743983632a2571183.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论