【问题标题】:Do not want to display the row index column in the dojox.grid.DataGrid不想在 dojox.grid.DataGrid 中显示行索引列
【发布时间】:2012-05-31 20:41:27
【问题描述】:

我使用 dojox.grid.DataGrid 来呈现表格。我还在第一列中包含了 dojox.grid._CheckBoxSelector。我看到在复选框列和实际数据列之间总是呈现一个名为 Row 的列。

能否请您告诉我如何不呈现此 Row 索引列?创建结构时我可以设置任何标志吗?还是我需要删除任何字段?

非常感谢。

==========================================

dojo
        .ready(function() {
            var myDojolayout = [
                    {
                        type : "dojox.grid._CheckBoxSelector"
                    },
                    // Now include the data cells in a view occupying the rest of the grid.
                    [
                            new dojox.grid.cells.RowIndex({
                                width : "10%"
                            }),
                            {
                                name : "Summary",
                                fields : [ "firstName", "lastName",
                                        "companyName", "phone", "email" ],
                                editable : true,
                                width : "10%",
                                formatter : function(fields) {
                                    var first = fields[0], last = fields[1], notes = fields[2], phone = fields[3], email = fields[4];
                                    return first + " " + last + "<br>"
                                            + companyName + "<br>" + phone
                                            + "<br>" + email;
                                }
                            }

                    ] ]

            var mygrid = new dojox.grid.DataGrid({
                id : "gridId",
                store : store,
                autowidth : "true",
                rowselector : "15px",
                keepRows : "30",
                rowsPerPage : "10",
                style : "height:300px",
                structure : myDojolayout
            }, "gridContainer");
            mygrid.startup();
            dojo.connect(mygrid, "onApplyEdit", function(row) {
                store.

【问题讨论】:

  • 这不是因为你的布局有新的 dojox.grid.cells.RowIndex({ width : "10%" })
  • 您好,感谢您的回复。我删除了新的 dojox.grid.cells.RowIndex({width : "10%" }) 行,但该列仍然显示。还有其他解决方案吗?非常感谢。

标签: dojo


【解决方案1】:

我可以通过将您的布局替换为以下内容来完成此工作。有些字段可能不起作用,因为它们是特定于实现的,但是在这些更改之后我没有看到 rowIndex 或类似的东西。

 var myDojolayout = [
                {
                    type : "dojox.grid._CheckBoxSelector"
                },
                // Now include the data cells in a view occupying the rest of the grid.

                        { cells: [{
                            name : "Summary",
                            fields : [ "firstName", "lastName",
                                    "companyName", "phone", "email" ],
                            editable : true,
                            width : "500px",
                            formatter : function(fields) {
                                var first = fields[0], last = fields[1], notes = fields[2], phone = fields[3], email = fields[4],companyName= fields[5];
                                return first + " " + last + "<br>"
                                        + companyName + "<br>" + phone
                                        + "<br>" + email;
                            }}]
                        }

                ];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多