This article mainly describes how to select the last selected node before refreshing by default after ExtJS refresh, and the friends you need can refer to the following
After the tree node is operated on, it is often necessary to reload the tree, but many businesses need to select the last selected node by default after the tree is refreshed. In this way, you must first save the previous selected node information, after reload again through the information of the node to expand layer to the node. Query for a long time finally found a feasible solution, is through the path of the node to record the location of the node information, and then through the path from the root node to start layers, until the last node. Complete the code below: first is the extjs3.x version of the method: code as follows://Get the selected node var node = Tree.getselectionmodel (). Getselectednode (); if (node = null) {//Not checked for overload tree Tree.getrootnode (). Reload (); } else {//overload tree and select last selected section by default Point var path = Node.getpath (' id '); tree.getloader (). Load (Tree.getrootnode (), function (TreeNode) { Tree.expandpath (path, ' id ', function (bsucess, Olastnode) { Tree.getselectionmodel (). Select (Olastnode); }); }, this); } Extjs3.0 different Extjs4.2 with the following code as follows: Idpath = Selnode.getpath ("id" ); Tree.getstore (). Load ({ node:tree.getRootNode (), callback:function () { Tree.expandpath ( Idpath, ' id '); } }); It is important to note that the JSON data point of the returned tree in the background must contain the id attribute, which I did not originally have, but I put the GetPath methodparameter to a different property. It turned out to be ineffective, and finally the id attribute was added to the JSON to succeed.