I am using Kendo ui grid:http://demos.telerik.com/kendo-ui/grid/index
I am doing server side sorting now what i want is when "no records are available" then i want to disable sorting on some column.
So how to do it??
Note:I am using Script for kendo ui.
We can not set enable/disable sorting at run time in kendo Grid but we can indirectly achieve this thing by using below code snippet.
<body>
<div id="grid"></div>
<script src="http://demos.telerik.com/kendo-ui/content/shared/js/products.js"></script>
<script>
$(document).ready(function () {
//To test your requirement please remove comment from below code line
//products = null;
$("#grid").kendoGrid({
dataSource: {
data: products,
schema: {
model: {
fields: {
ProductName: { type: "string" },
UnitPrice: { type: "number" },
UnitsInStock: { type: "number" },
Discontinued: { type: "boolean" }
}
}
}
},
height: 550,
groupable: true,
sortable: true,
columns: [
"ProductName",
{ field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "130px" },
{ field: "UnitsInStock", title: "Units In Stock", width: "130px" },
{ field: "Discontinued", width: "130px" }
]
});
$("#grid .k-grid-header .k-link").click(function (e) {
if ($("#grid").data("kendoGrid").dataSource.data().length == 0) {
e.stopPropagation();
}
});
});
</script>
</body>
Let me know if any concern.