easyui select the last selected node after reload

we urually reload easyui tree after edit some nodes, but after reload, the selected node before can not be re-selected. here’s a simple way:

<script type=”text/javascript”>
var selectednode=null;
onClick: function(node){
selectednode = node;
onLoadSuccess: function(node, data){
$(‘#orgTree’).tree(‘collapseAll’);//collapse all but expand the root node
var root = $(‘#orgTree’).tree(‘getRoot’);
if(selectednode != null){// if have seleted node before reload, select the node and expand //all parents.
var node = $(‘#orgTree’).tree(‘find’, selectednode.id);
if(node != null){
while(node != null){
node = $(‘#orgTree’).tree(‘getParent’,node.target);




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s