Jquery easyui combotree remove the check expansion

Recently doing a project need to use Jquery easyui combotree the controls, but the controls once the choice is not clear the select value
then look for ways to be able to choose to have emptied a relatively simple solution is as follows:

Stitching in the background json data when the last data spliced ​​plus an option to clear the check

JSONArray datas = new JSONArray();// datas还要设置控件需要的其他值
JSONObject object = new JSONObject();// 在其他值设置完成后,在最后添加一个节点
object.put("id", "0");
object.put("text", "清除选中");
datas.add(object);

Then do the processing in onSelect event combotree's, to determine whether the selected node ID is equal to empty the selected node id (ie node.id == 0), if they are equal then emptied of value combotree

$('#parent_code').combotree({    
	url: '${ctx}/act/getTree.do',//加载数据
	//选择树节点触发事件  
	onSelect : function(node) {  
	        if(0 == node.id){
		        //清除选中
		        $('#parent_code').combotree('clear');
	        }
	}  
});

So to solve the problem after selecting combotree control values ​​can not be removed.
Published 90 original articles · won praise 21 · views 470 000 +

Guess you like

Origin blog.csdn.net/yx13649017813/article/details/48006151
Recommended