item(i)为null或不是带过滤选项的锁定网格中的对象(extjs3.4)

hds.item(i) is null or not an object in locking grid with filtering option (extjs 3.4)

本文关键字:网格 锁定 extjs3 选项 对象 null item 过滤      更新时间:2023-09-26

我创建了一个锁定列网格,其中包含所有列的过滤选项。现在,当我试图过滤最后一列时,它抛出错误

hds.item(i) is null or not an object

在updateColumnHeadings中:函数(){

    var view = this.grid.getView(),
        hds, i, len, filter;
    if (view.mainHd) {
        hds = view.mainHd.select('td').removeClass(this.filterCls);
        for (i = 0, len = view.cm.config.length; i < len; i++) {
            filter = this.getFilter(view.cm.config[i].dataIndex);
            if (filter && filter.active) {
                hds.item(i).addClass(this.filterCls);
            }
        }
    }
},

过滤.ux部分,view.cm.config.length=10i=8,即其不采用锁定列

(这里的列数,从最后开始,抛出err=锁定列数,即长度不匹配)

如何解决这个错误

或者我在编码时遗漏了一些东西,所以view.mainHd只占用了未锁定的列。。请帮忙。。

问题出现在锁定标头中,当应用进行过滤时,该标头未进行联合排序

// Over-writing the filter function to accomodate Locking grid 
    Ext.LockingFilter = Ext.extend(Ext.ux.grid.GridFilters, {
        updateColumnHeadings : function () {
            var view = this.grid.getView(),
                hds, i, len, filter, lockLen;
            if (view.lockedHd) {
                lockLen = view.lockedHd.select('td').elements.length;
                hds = view.lockedHd.select('td').removeClass(this.filterCls);
                for (i = 0, len = lockLen; i < len; i++) {
                    filter = this.getFilter(view.cm.config[i].dataIndex);
                    if (filter && filter.active) {
                        hds.item(i).addClass(this.filterCls);
                    }
                }
            }
            if (view.mainHd) {
                var mainLen = view.mainHd.select('td').elements.length;
                hds = view.mainHd.select('td').removeClass(this.filterCls);
                for (i = 0, len = mainLen; i < len; i++) {
                    filter = this.getFilter(view.cm.config[i+lockLen].dataIndex);
                    if (filter && filter.active) {
                        hds.item(i).addClass(this.filterCls);
                    }
                }
            }
        }
    });