简体   繁体   English

Extjs 4.2缓冲存储区引发Uncaught NotFoundError:试图在不存在的上下文中引用Node。 镀铬

[英]Extjs 4.2 buffered store throws Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist. on chrome

here is my store: 这是我的商店:

Ext.define('NG.store.WhatsNews', {
    extend: 'NG.store.AbstractStore',
    model: 'NG.model.auxClasses.notifications.WhatsNew',
    alias: 'store.whatsnewstore',
    autoLoad:true,
    buffered: true,
    remoteFilter: true,
    remoteGroup: true,
    remoteSort: true,
    pageSize: 50
});

When I scroll the grid down and the buffered view tries to load the new records I get an error ' An attempt was made to reference a Node in a context where it does not exist. 当我向下滚动网格并且缓冲视图尝试加载新记录时,我得到一个错误' 尝试在不存在的上下文中引用Node。 '. '。

Here is the error as I caught it on chrome dev tools.: 这是我在chrome开发工具上发现的错误:

在此处输入图片说明

I watched the variables and it arrears that the call for : 我看了看变量,并拖欠了对的呼吁:

me.view.bufferRender(newRecords, me.endIndex + 1)

results in an array of nodes that is not in the same length as 导致节点数组的长度与长度不同

recCount = newRecords.length

which causes an error when frag.appendChild(newNodes[i]); frag.appendChild(newNodes[i]);时会导致错误 is called. 叫做。

Is that a known issue??? 这是一个已知问题吗???

Is there a work around? 有没有解决的办法?

UPDATE 更新

I have created the following override: 我创建了以下替代:

Ext.override(Ext.view.NodeCache, {
    /**
    * Appends/prepends records depending on direction flag
    * @param {Ext.data.Model[]} newRecords Items to append/prepend
    * @param {Number} direction `-1' = scroll up, `0` = scroll down.
    * @param {Number} removeCount The number of records to remove from the end. if scrolling
    * down, rows are removed from the top and the new rows are added at the bottom.
    */
    scroll: function (newRecords, direction, removeCount) {
        var me = this,
            elements = me.elements,
            recCount = newRecords.length,
            i, el, removeEnd,
            newNodes,
            nodeContainer = me.view.getNodeContainer(),
            frag = document.createDocumentFragment();

        // Scrolling up (content moved down - new content needed at top, remove from bottom)
        if (direction == -1) {
            for (i = (me.endIndex - removeCount) + 1; i <= me.endIndex; i++) {
                el = elements[i];
                delete elements[i];
                el.parentNode.removeChild(el);
            }
            me.endIndex -= removeCount;

            // grab all nodes rendered, not just the data rows
            newNodes = me.view.bufferRender(newRecords, me.startIndex -= recCount);
            for (i = 0; i < recCount; i++) {
                elements[me.startIndex + i] = newNodes[i];
                frag.appendChild(newNodes[i]);
            }
            nodeContainer.insertBefore(frag, nodeContainer.firstChild);
        }

        // Scrolling down (content moved up - new content needed at bottom, remove from top)
        else {
            removeEnd = me.startIndex + removeCount;
            for (i = me.startIndex; i < removeEnd; i++) {
                el = elements[i];
                delete elements[i];
                el.parentNode.removeChild(el);
            }
            me.startIndex = i;

            // grab all nodes rendered, not just the data rows
            newNodes = me.view.bufferRender(newRecords, me.endIndex + 1);
            for (i = 0; i < newNodes.length ; i++) {
                elements[me.endIndex += 1] = newNodes[i];
                frag.appendChild(newNodes[i]);
            }
            nodeContainer.appendChild(frag);
        }
        // Keep count consistent.
        me.count = me.endIndex - me.startIndex + 1;
    }
});

This prevents the error thrown in chrome but the last record does not show!!! 这样可以防止在chrome中抛出错误,但不会显示最后一条记录!!!

Anyone with a better idea? 有更好的主意吗?

It appears to be a known issue of ExtJS 4.2.1. 它似乎是ExtJS 4.2.1的已知问题。

http://www.sencha.com/forum/showthread.php?265323 http://www.sencha.com/forum/showthread.php?265323

And it was fixed under 4.2.2 它已在4.2.2下修复

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 这是“未捕获的NotFoundError:如何尝试在不存在的上下文中引用节点”。 ”错误? - How is this an “Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist. ” error? Uncaught NotFoundError:尝试在不存在的上下文中引用节点 - Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist javascript insertBefore方法结果为“ NotFoundError:尝试在不存在的上下文中引用Node。” - javascript insertBefore method results to “NotFoundError: An attempt was made to reference a Node in a context where it does not exist.” 如何解决ExtJS 4.2的缓冲存储中的findRecord问题 - How do you resolve the findRecord issue in buffered store for ExtJS 4.2 Chrome 扩展程序“接收端不存在”。 错误 - Chrome Extension "Receiving end does not exist." Error 未捕获的错误:NotFoundError:DOM异常8 Chrome扩展 - Uncaught Error: NotFoundError: DOM Exception 8 Chrome Extension ExtJS-使用RegEx过滤缓冲存储 - ExtJS - Filter buffered store with RegEx Extjs 4.2 TreeGrid折叠/展开节点不会删除先前的节点 - Extjs 4.2 TreeGrid collapse/expand node does not remove preceding node 控制不存在。为什么? - Control does not exist. Why? 未捕获的 NotFoundError:无法在“节点”上执行“replaceChild”:要替换的节点不是该节点的子节点 - Uncaught NotFoundError: Failed to execute 'replaceChild' on 'Node': The node to be replaced is not a child of this node
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM