我试图将我的数据源排序为多个字段,但它不起作用。 这是我的代码:
var dataSource = new kendo.data.DataSource({
transport: {
read: notifURL
},
pageSize: 30,
sort: [{ field: "ID", dir: "desc" },
{ field: "Time", dir: "desc" }]
});
答案 0 :(得分:0)
答案是here:
<script>
var dataSource = new kendo.data.DataSource({
data: [
{ name: "Tea", category: "Beverages" },
{ name: "Coffee", category: "Beverages" },
{ name: "Ham", category: "Food" }
],
sort: [
// sort by "category" in descending order and then by "name" in ascending order
{ field: "category", dir: "desc" },
{ field: "name", dir: "asc" }
]
});
dataSource.fetch(function(){
var data = dataSource.view();
console.log(data[1].name); // displays "Coffee"
});
</script>