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.