3

我正在尝试使用 sencha 中的示例并配置 rowexpander。当网格渲染时,扩展器已经为每一行打开并且里面没有任何东西。当我点击它的图标时,会生成以下错误: Uncaught TypeError: Cannot call method 'addCls' of null 有没有其他人遇到过这个问题?有人可以发布一个 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);
                }
            }
        }]
4

0 回答 0