is there a way to manipulate(transform) data right after the request to the server or before binding? I need to make request to the server, transform result data and then bind that data to the kendo grid.
7
votes
1 Answers
20
votes
Yes, you should use either parse in the schema definition or in the dataBound event.
Example in parse
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: ..
dataType: "json"
}
},
schema: {
parse: function(data) {
// Example adding a new field to the received data
// that computes price as price times quantity.
$.each(data, function(idx, elem) {
elem.price = elem.qty * elem.price;
});
return data;
}
}
});