Extjs 4.1.3使用rowexpander插件的嵌套网格不起作用

时间:2013-03-11 11:31:21

标签: extjs4.1

我试图使用sencha中的示例并配置rowexpander。当网格渲染时,扩展器已经为每一行打开,内部没有任何内容。当我点击它的图标时,会产生以下错误: 未捕获的TypeError:无法调用null的方法'addCls' 还有其他人遇到过这个问题吗?有人可以发一个hpw的例子来使用rowexpander。

        plugins : [{
            ptype : 'rowexpander',
            rowBodyTpl : ['<div id="NestedGridRow-{rowId}"></div>'],
            pluginId : 'rowexpanderplugin',
            selectRowOnExpand : true,

            // this gives each row a unique identifier based on record's "acct_no"
            rowBodyTpl : ['<div id="NestedGrid-{name}" ></div>'],

            // stick a grid into the rowexpander div whenever it is toggled open
            toggleRow : function(rowIdx) {
                var rowNode = this.view.getNode(rowIdx), row = Ext.get(rowNode), nextBd = Ext.get(row).down(this.rowBodyTrSelector), hiddenCls = this.rowBodyHiddenCls, record = this.view.getRecord(rowNode), grid = this.getCmp(), name= record.get('name'), targetId = 'NestedGrid-' + name;

                if (row.hasCls(this.rowCollapsedCls)) {
                    row.removeCls(this.rowCollapsedCls);
                    this.recordsExpanded[record.internalId] = true;
                    this.view.fireEvent('expandbody', rowNode, record, nextBd.dom);

                    if (rowNode.grid) {
                        nextBd.removeCls(hiddenCls);
                        rowNode.grid.doComponentLayout();
                        rowNode.grid.view.refresh();
                    } else {

                        // this is the store for the inner grid
                        Ext.create('innsergridstore', {

                            autoLoad : {
                                callback : function() {

                                    // create the inner grid and render it to the row
                                    nextBd.removeCls(hiddenCls);
                                    var grid = Ext.create('NestedGrid', {// <-- this is my "inner" grid view
                                        renderTo : targetId,
                                        store : this,
                                        row : row
                                    });

                                    rowNode.grid = grid;


                                    grid.suspendEvents();
                                }
                            }
                        });
                    }

                } else {
                    row.addCls(this.rowCollapsedCls);
                    nextBd.addCls(this.rowBodyHiddenCls);
                    this.recordsExpanded[record.internalId] = false;
                    this.view.fireEvent('collapsebody', rowNode, record, nextBd.dom);
                }
            }
        }]

0 个答案:

没有答案