【问题标题】:Kendo Grid. Razor Mode. Column Sorting剑道网格。剃刀模式。列排序
【发布时间】:2014-01-04 15:52:45
【问题描述】:

我在当前项目中使用 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"));

【问题讨论】:

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


    【解决方案1】:

    为列创建模板和/或使用 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"
    });
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-05
    • 1970-01-01
    • 2014-01-08
    • 1970-01-01
    相关资源
    最近更新 更多