dak*_*akt 7 kendo-ui kendo-grid
有没有办法在请求之后或绑定之前操作(转换)数据?我需要向服务器发出请求,转换结果数据,然后将该数据绑定到kendo网格.
Ona*_*Bai 17
是的,您应该parse在schema定义或dataBound事件中使用.
例子 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;
}
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5365 次 |
| 最近记录: |