0

我尝试在我的 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();


    }
);
4

1 回答 1

0

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

于 2015-09-07T09:59:17.757 回答