【问题标题】:Adjusting Shield UI Grid columns sequence调整 Shield UI Grid 列顺序
【发布时间】:2014-02-21 10:32:35
【问题描述】:

经过一些研究,我似乎无法解决 Shield UI Grid 控件的问题。我希望能够允许用户按照他们选择的顺序放置列。我有类似的命令,如下面的代码:

$(function () {
    $("#grid").shieldGrid({
        dataSource: {
            data: products
        },
        columns: [
            "ProductName",
            { field: "['Category']['CategoryName']", title: "CategoryName", format: "{0:c}", width: "330px" },
            { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "130px" },
            { field: "UnitsInStock", title: "Units In Stock", width: "130px" },
            { field: "Discontinued", width: "130px" }
        ]
    });
});

在我没有找到解决方案后,我在页面上放置了一些额外的控件来显示列序列,但这并不完全符合我的要求。 有没有办法动态改变网格列的位置?

【问题讨论】:

    标签: javascript grid shieldui


    【解决方案1】:

    事实上,解决方案非常简单。 Shield UI Grid 控件支持动态列重新排序。 您只需在代码中包含设置为 true 的 columnReorder 属性:

    columnReorder: true,
    

    除此之外,无需使用其他控件。使用拖放用户只需拖动列并将其放置在所需的位置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多