Environment:
- kendo version: 2013.1.319
dataSource:
productsDataSource = new kendo.data.DataSource({ type: "odata", transport: { read: "http://www.mydomain.com/odata.svc/products", dataType: "json", contentType: "application/json" } schema: { type: "json", data: function(data){ return data.value; }, total: function(data){ return data['odata.count']; }, model: product }, pageSize: 50, serverPaging: true, serverFiltering: true, serverSorting: true });
Get data:
productsDataSource.filter([{ field: "Id", operator: "eq", value: 5 }]); //this will send an httprequest
productsDataSource.fetch(function (e) { tempDataStorage = e.items; //more logic to dealing with the data; });
problems:
- need to use the fetch method of the dataSource for data processing(widgets initialization, data binding...etc);
- avoid sending two httprequests when setting filters before fetch;
- the filter condition need to be changed at runtime.