【问题标题】:Dojox.grid.DataGrid with empty Data带有空数据的 Dojox.grid.DataGrid
【发布时间】:2013-03-06 01:40:00
【问题描述】:

我的问题是数据网格没有出现我需要它是空的,这样我就可以添加项目来与现有的 FilteringSelect Formatter 建立关系。

function formatter1() {
            var x = new FilteringSelect({
            name: "Account Select",
            //value: "1",
            store: remoteData,
            searchAttr: "name",
            onChange: function () {
                console.log("EI");
            }

        });
        x._destroyOnRemove=true;
        return x;
}

// 关系数据网格

var DataRelations = { identifier: "id", items: [] };

storeRelations = new Write({data: DataRelations, clearOnClose: true });

var layoutRelations = [
    {'name': "Words", field: "word", width: 40 },
    {'name': "Account", field: "id", width: 40, formatter: formatter1 }

    //,{'name': "Accounts Available", field: "AccountsAvailable", width: 20, formatter: formatter1}
];

var gridRelations = new DataGrid({
        id: 'gridRelations',
        store: storeRelations,
        structure: layoutRelations,
    rowSelector: '10px'
});

/*append the new grid to the div*/
gridRelations.placeAt("gridDivRelations");

/*Call startup() to render the grid*/
gridRelations.startup();

【问题讨论】:

    标签: dojox.grid.datagrid dojo


    【解决方案1】:

    这是一个基于您的代码的工作 jsfiddle:

    http://jsfiddle.net/LFk8Z/

    您需要为网格的 DIV 容器指定宽度和高度。也许这就是最初的问题。您还需要加载网格 css 资源。您的格式化程序函数没有参数,但您需要指定一个:

    function formatter1(x) {
    // Format cell value (which is in x) in here.
    }
    

    【讨论】:

    • 我的问题实际上更多的是未指定的 div 尺寸。放置后它显示得很好。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-03
    • 1970-01-01
    • 1970-01-01
    • 2012-05-29
    • 2011-11-23
    • 2010-12-02
    相关资源
    最近更新 更多