I have a request to make my KendoUI Grid start with one column sorted, and from there only allow the column to have sorted asc and sorted desc options...meaning no unsorted option. What I mean is when page is first viewed, there is the icon that shows its sorted asc...and if the column header is clicked then it goes to sorted desc and then if clicked again it goes to sorted asc. Currently the default Kendo behavior is that the third click puts the grid in an unsorted mode with no sorted icon. If it helps, my code is below:
$("#grid").kendoGrid({
dataSource: {
data: carList,
schema: {
model: {
fields: {
"Car": { type: "number" },
"Miles": { type: "number" }
}
}
},
sort: { field: "Miles", dir: "asc" }
},
height: 338,
scrollable: true,
sortable: true,
filterable: false,
pageable: false,
columns: [
{
field: "Car",
width: 40,
sortable: true,
hidden: false
},
{
field: "Miles",
width: 60,
sortable: true,
hidden: false
}
]
});
};
Does anyone know if there is a built-in way to achieve this toggle like effect? If not, any ideas on how to achieve this without having to totally write my own sort functions? Any ideas are great, thanks so much!
I am just blind, there is a built in way...for others who may have missed it too:
sortable: {
allowUnsort: false
}
Thanks so much!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With