首先先加载combotree:
$('#' + prefix + 'selectReceive').combotree( { url : baseUrl + "getUserNodeTree?ajax=true", multiple : true, editable : false, separator : ';', panelHeight : 300, content : receive, onHidePanel : function() { $('#' + prefix + 'receive').val( $('#' + prefix + 'selectReceive').combotree( 'getValues')); } });
设置combotree的值之前先清空combotree里面的缓存值
$('#' + prefix + 'selectReceive').combotree('clear');
之后设置里面的combotree的值
var arr = value.split(','); for ( var i = 0; i < arr.length; i++) { node=$('#' + prefix + 'selectReceive').combotree('tree').tree('find',arr[i]); $('#' + prefix + 'selectReceive').combotree('tree').tree('check',node.target); }
这里面的value是一个用“,”隔开的字符串,
转载于:https://blog.51cto.com/zhengkeke/1328951