Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/412.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 重新配置网格时出错_Javascript_Extjs - Fatal编程技术网

Javascript 重新配置网格时出错

Javascript 重新配置网格时出错,javascript,extjs,Javascript,Extjs,我在应用程序中有一个网格。一切都很好。然后,我想更改网格以使用保存配置中的不同列。这也很好——除非我先打开一列的过滤器菜单。在此之后,更改列布局会在“重新配置”函数中导致深层错误,此时焦点将重新应用于网格。以下是Ext.view.Table类中发生错误的代码: onFocusEnter: function(e) { var me = this, fromComponent = e.fromComponent, navigationModel = m

我在应用程序中有一个网格。一切都很好。然后,我想更改网格以使用保存配置中的不同列。这也很好——除非我先打开一列的过滤器菜单。在此之后,更改列布局会在“重新配置”函数中导致深层错误,此时焦点将重新应用于网格。以下是Ext.view.Table类中发生错误的代码:

    onFocusEnter: function(e) {
    var me = this,
        fromComponent = e.fromComponent,
        navigationModel = me.getNavigationModel(),
        focusPosition,
        br = me.bufferedRenderer,
        focusRecord, focusRowIdx, focusTarget, scroller;
    // Focusing an internal focusable while TD navigation is disabled;
    // We do not intervene.
    if (me.actionableMode) {
        return;
    }
    // The underlying DOM event
    e = e.event;
    // We can only focus if there are rows in the row cache to focus *and* records
    // in the store to back them. Buffered Stores can produce a state where
    // the view is not cleared on the leading end of a reload operation, but the
    // store can be empty.
    if (!me.cellFocused && me.all.getCount() && me.dataSource.getCount()) {
问题是me.dataSource为空。我觉得这很奇怪,因为这一行前面的注释指出了使用缓冲存储时空存储的潜在问题——我就是缓冲存储,但却对此一无所知


我肯定为重新配置功能提供了一个有效的存储,因为除非首先显示filter菜单,否则它可以正常工作。有什么想法吗?

我已经进一步研究了这个问题,并研究了为什么数据源值应该为空。在调用堆栈的更高层,我们通过Ext.util.StoreHolder类来绑定存储。这包括将存储绑定到侦听器的代码,然后引发事件以让系统对更改作出反应

    bindStore: function(store, initial, propertyName) {
    ...
    if (store !== oldStore) {
        if (oldStore) {
            ... lines to unbind the old store
        }
        if (store) {
            me[propertyName] = store = Ext.data.StoreManager.lookup(store);
            me.bindStoreListeners(store);
            me.onBindStore(store, oldStore);
        } else {
            me[propertyName] = null;
错误发生在onBindStore中。我在它之前添加了代码,从源代码设置数据源,错误消失了

虽然它可以工作,但我还是有点犹豫,因为它正在改变真正的ExtJs代码。如果你能想出更好的答案,请分享