KendoUI Grid alter filter and sort in one refresh-Collection of common programming errors
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