剑道网格。剃刀模式。列排序

时间:2014-01-04 15:52:45

标签: kendo-ui kendo-grid kendo-asp.net-mvc

我在当前项目中使用了Kendo UI Grid。我发现如果列有模板,排序不起作用。 在以下解决方案中仅针对javascript网格实现修复: http://www.kendoui.com/forums/kendo-ui-web/grid/row-template-sorting.aspx

如何在Razor模式下进行排序?

带模板的列示例:      columns.Bound(e => e.OrderNumber).Template(e => @ Html.ActionLink(e.OrderNumber.ToString(),“Test”,“Test”));

1 个答案:

答案 0 :(得分:2)

为列创建模板和/或使用RowTemplate不应影响排序支持。

Here是一个通过JavaScript的例子(Razor最后输出JavaScript,应该没什么区别)

$("#grid").kendoGrid({
    dataSource: dataSource,
    pageable: true,
    sortable:true,
    rowTemplate:"foo #= ProductID#",
    height: 430,
    toolbar: ["create"],
    columns: [
        { field:"ProductName", title: "Product Name" },
        { field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "100px" },
        { field: "UnitsInStock", title:"Units In Stock", width: "100px" },
        { field: "Discontinued", width: "100px" },
        { command: ["edit", "destroy"], title: " ", width: "160px" }],
    editable: "popup"
});
相关问题