Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>1.</strong> If you are trying to modify some part of the existing root first you need to get hold of the root node. You can get hold of your root node using <code>getRootNode()</code> available with your <code>TreeStore</code>. example: </p> <pre><code> var node = treeObject.getStore().getRootNode(); </code></pre> <p>Now, to modify the data, you can make use of <code>data</code> property. For example, if you need to change the root node's text, you can:</p> <pre><code>node.data.text = 'New Root'; // You can access any other property of your node's data model the same way </code></pre> <p><strong>2.</strong> If you need to replace the entire node you can make use of the <code>setRootNode()</code> which is also available with your <code>TreeStore</code>. You will have to pass the appropriate data model used for your TreeStore.</p> <p>Since, you are trying to replace your root, you definitly need to use <code>setRootNode()</code>. Here is an example code replacing the root:</p> <pre><code>//your tree click handler... itemclick : function(view,rec,it,inx,ev) { var root = view.getTreeStore().getRootNode(); var newRoot = root.getChildAt(inx).copy('xx',true); view.getTreeStore().setRootNode(newRoot); } </code></pre> <p>Ideally, this code should work. but there is a <a href="http://www.sencha.com/forum/showthread.php?134844-tree-node-copy%28deep%29-not-working-%284.0.1%29&amp;highlight=tree%20copy" rel="nofollow">small bug</a> in <code>copy()</code> that causes to break this code. A temporary solution (I would not recommend modifying library files) is available at the forum (refer the above link).</p> <p>Another way would be to code your own <code>copy</code> code like:</p> <pre><code>var root = view.getTreeStore().getRootNode(); var newRoot = root.getChildAt(inx); view.getTreeStore().setRootNode(newRoot); // for each child in newRoot, create child for the newly assigned root. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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