【发布时间】:2016-01-29 11:29:35
【问题描述】:
我正在使用剑道 ui 网格:http://demos.telerik.com/kendo-ui/grid/index
我现在正在做服务器端排序,我想要的是当“没有可用的记录”时,我想禁用某些列的排序。
那该怎么做呢??
注意:我使用的是剑道 ui 脚本。
【问题讨论】:
标签: kendo-ui telerik kendo-grid kendo-asp.net-mvc telerik-grid
我正在使用剑道 ui 网格:http://demos.telerik.com/kendo-ui/grid/index
我现在正在做服务器端排序,我想要的是当“没有可用的记录”时,我想禁用某些列的排序。
那该怎么做呢??
注意:我使用的是剑道 ui 脚本。
【问题讨论】:
标签: kendo-ui telerik kendo-grid kendo-asp.net-mvc telerik-grid
我们不能在 kendo Grid 运行时设置启用/禁用排序,但我们可以通过使用下面的代码 sn-p 间接实现这一点。
<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>
如果有任何问题,请告诉我。
【讨论】: