Note that there are some explanatory texts on larger screens.

plurals
  1. POExtjs 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
    text
    copied!<p>here is my store:</p> <pre><code>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 }); </code></pre> <p>When I scroll the grid down and the buffered view tries to load the new records I get an error '<em>An attempt was made to reference a Node in a context where it does not exist.</em>'.</p> <p>Here is the error as I caught it on chrome dev tools.:</p> <p><img src="https://i.stack.imgur.com/fq6ou.png" alt="enter image description here"></p> <p>I watched the variables and it arrears that the call for :</p> <pre><code>me.view.bufferRender(newRecords, me.endIndex + 1) </code></pre> <p>results in an array of nodes that is not in the same length as </p> <pre><code>recCount = newRecords.length </code></pre> <p>which causes an error when <code>frag.appendChild(newNodes[i]);</code> is called.</p> <p>Is that a known issue???</p> <p>Is there a work around?</p> <p><strong>UPDATE</strong></p> <p>I have created the following override:</p> <pre><code>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 &lt;= 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 &lt; 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 &lt; 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 &lt; 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; } }); </code></pre> <p>This prevents the error thrown in chrome but the last record does not show!!!</p> <p>Anyone with a better idea?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload