控件声明 :
$("#nscope").combotree({
url:'<%=basePath%>sysManage/ajaxOrganizeTree.action?orgCode=${userType}',
multiple:true
});
取值:
1、 var t = $('#nscope').combotree('tree'); // 获取树对象
var n = t.tree('getChecked'); // 获取选择的节点
var fucku = new Array();
for(var ik=0;ik < n.length;ik++){
if(n[ik].text == "中国"){
fucku[ik] = n[ik+1].text;
ik++;
}else{
fucku[ik] = n[ik].text;
}
}
alert(fucku.join()); //打印出来
$('#nscope').combotree('setValue',fucku.join());
<pre name="code" class="javascript">
<pre name="code" class="javascript">2、$('#nscope').combotree('getText');
<pre name="code" class="javascript">alert($('#nscope').combotree('getText')); //打印出来
现在碰到一个问题,不想要id,想要别的东西orgCode,但貌似这样的初始化是无效的,value还是id,郁闷
$("#nscope").combotree({
url:'<%=basePath%>sysManage/ajaxOrganizeTree.action?orgCode=${userType}',
multiple:true,
valueField:'orgCode',
textField:'text',
});