4

收到新信息后,我无法尝试更改数据网格的结构。每次进行查询时,我都需要能够更改列数。

我用来创建网格的 javascript 代码

function setgrid(){
    var gridLayout = [];
    var key, i;
    for(i = 0; i < 10; i++) {
        key = i + "";
        gridLayout.push({
            field: key, 
            name: key,
            editable: false
        });                       
    }

    // create a new grid:
    billsGrid = new dojox.grid.DataGrid({
        query: {},
        //store: store,
        clientSort: true,
        rowSelector: '20px',
        structure: gridLayout,
        columnReordering: true
    }, gridContainer);

    // Call startup, in order to render the grid:
    billsGrid.startup();
}

和html:

<div id="gridContainer" style="width: 650px; height: 600px; border: 1px solid silver;" />

我将如何更改网格以具有 5 列的新布局?

4

2 回答 2

8

找到它,只需要知道调用什么来将新布局应用于现有网格。在这种情况下: billsGrid.setStructure(newLayout);

于 2010-12-08T08:11:57.607 回答
1

在最新版本的道场中,没有方法setStructure。您可能想使用:

grid.set('structure', newStructure);
于 2017-06-28T18:30:33.960 回答