easyui tree unselect node

easyui tree have no unselect function or attribute, but we can attend one to unselect a node:

$.extend($.fn.tree.methods,{
unselect:function(jq,target){
return jq.each(function(){
var opts = $(this).tree(‘options’);
$(target).removeClass(‘tree-node-selected’);
if (opts.onUnselect){
opts.onUnselect.call(this, $(this).tree(‘getNode’,target));
}
});
}
});

var snode = $(‘#orgTree’).tree(‘getSelected’);
if(snode != null){
$(‘#orgTree’).tree(‘unselect’,snode.target);
}

//reference: http://www.jeasyui.com/forum/index.php?topic=2821.0

This entry was posted in Computer, Java, javascript. Bookmark the permalink.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s