【问题标题】:use of onCellWidgetCreated in Dojo Gridx (to add button to cell)在 Dojo Gridx 中使用 onCellWidgetCreated(将按钮添加到单元格)
【发布时间】:2015-11-15 22:32:21
【问题描述】:

我尝试在我的 Gridx 的最后一列添加一个按钮,但是,该按钮未显示,并且在其他表格数据上方,网格仅显示“正在加载...”。

需要并声明了 Cell Widget,设置了 widgetInCell 并添加了 onCellWidgetCreated 函数。将 onCellWidgetCreated 函数替换为 alert 时,会显示每行的警告消息,并且“正在加载...”消失。我的感觉是onCellWidgetCreated函数不对?

我的代码如下所示,当与 Gridx 网站上的一些示例进行比较时,我找不到问题。

require([
    "gridx/Grid",
    "gridx/core/model/cache/Sync",
    "dojo/store/Memory",
    "dojo/domReady!",
    "gridx/modules/CellWidget",
    "dijit/form/Button"
], function(Grid, Cache, Memory,Button,CellWidget,domConstruct){
        var store = new Memory({
            idProperty:"CategoryID",
            data: jsondata
        });

        var grid = new Grid({
            id:"gridId",
            store: store,
            cacheClass: Cache,
            structure: [
                { 
                    id: "0", 
                    field: "CategoryID", 
                    name: "Kategorie (ID)", 
                    width: "100px" 
                },
                { 
                    id: "1", 
                    field: "CategoryName", 
                    name: "Kategoriename" 
                },
                { 
                    id: "2", 
                    field: "Attributes", 
                    name: "Attribute" 
                },
                { 
                    id: "3", 
                    field: "Actions", 
                    name: "Aktion", 
                    widgetsInCell: true,
                    onCellWidgetCreated: function(cellWidget, column){
                        var btn = new Button({
                            label: "Click me!"
                        });
                        btn.placeAt(cellWidget.domNode);
                    }
                }
            ],
            modules: [
                CellWidget
            ]
        });
        grid.placeAt("aGrid");
        grid.startup();


    }
);

【问题讨论】:

    标签: javascript dojo dojo.gridx gridx


    【解决方案1】:

    我遇到了 VirtualVScrolling 的另一个问题,发现这是由于包含自定义布局的有缺陷的 gridx css 文件造成的。 使用标准 css 文件时,“onCellWidgetCreated”也适用于我。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-15
      • 2015-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多