废话不多说直接上代码

 /生成模态框的路口卡口树function getModalBayonetTree(contener) {var nodeId_temp = null;$.ajax({url : ext.urlPath.apiUrl.getLaiZhouBayonetTree,type : 'get',dataType : 'json',success : function(data){$(contener).treeview({data: data,showTags: false,showCheckbox: true,showBorder: false,onhoverColor:"#F9F9F9",selectedBackColor:"#1e9fff",highlightSelected:true,collapseIcon: "fa fa-chevron-down",expandIcon: "fa fa-chevron-right",onNodeChecked: function(event, node) { //选中节点if (nodeId_temp != null) {$(contener).treeview('uncheckNode', [nodeId_temp, {slient: true}]);}nodeId_temp = node.nodeId;},/* onNodeUnchecked: function(event, node) { //取消选中节点}*/});$(contener).treeview('expandAll', {levels: 2,silent: true });}});}

nodeId_temp是在函数中定义的变量