【问题标题】:changing a dojo datagrids structure dynamically动态更改 dojo 数据网格结构
【发布时间】:2011-05-21 09:58:09
【问题描述】:

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

我用来创建网格的 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 列的新布局?

【问题讨论】:

    标签: dojo dojox.grid.datagrid


    【解决方案1】:

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

    grid.set('structure', newStructure);
    

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • 这会影响整个网格还是仅影响以下行?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-04-25
      • 1970-01-01
      • 2011-09-21
      • 1970-01-01
      • 2011-08-16
      • 2013-12-13
      • 2011-09-25
      相关资源
      最近更新 更多