0

我使用 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.
4

1 回答 1

0

我可以通过用以下内容替换您的布局来完成这项工作。有些字段可能不起作用,因为它们是特定于实现的,但是在这些更改之后我没有看到 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;
                            }}]
                        }

                ];
于 2012-06-07T22:21:28.750 回答