title: Duplicate of tree node
body: <p>I've read a lot of complaints about the treepanel, now I'm having some trouble with it.</p>
  
  <p>The first is that paging in the treegrid isn't working correctly. I found a solution in another post that doesn't work, so I'm trying to fix it for everybody.</p>
  
  <p>The second is where I need help. The first time a parent node is expanded, it make a call to the server and displays the children correctly. When I collapse and then expand it again, however, it will paint the same child twice. The tree crashes, showing this error:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'internalId' of undefined 
  </code></pre>
  
  <p>After working on it, I discovered that the problem is not when it inserts it again, but in the <code>beforeitemexpand</code> function. It appends the same child  twice, causing the js and the <code>treestore</code> to contain 2 nodes with the same <code>internalId</code>, which in turn causes the crash.</p>
  
  <p>Any ideas?</p>