easyui中combotree循环获取父节点至根节点并输出路径实现方法
前台页面:
<prename="code"class="html"><tdstyle="height:35px"colspan="7"> <inputid="fm_AEType"class="easyui-combotree"style="width:240px"/> <labelid="fm_AETypePath"/> </td></pre>
JavaScript页面(包括数据初始化):
initAEType:function(){
$.ajax({
url:AEActionUrl+'?action=listaetype&ParentType=',
dataType:'json',
success:function(jsonstr){
$('#fm_AEType').combotree({
data:jsonstr,
editable:false,
//lines:true,
valueField:'AE_TYPE_ID',
textField:'AE_TYPE_NAME',
onLoadSuccess:function(){
$('#fm_AEType').combotree('tree').tree("collapseAll");
},
onSelect:function(item){
varparent=item;
vartree=$('#fm_AEType').combotree('tree');
varpath=newArray();
do{
path.unshift(parent.text);
varparent=tree.tree('getParent',parent.target);
}while(parent);
varpathStr='';
for(vari=0;i<path.length;i++){
pathStr+=path[i];
if(i<path.length-1){
pathStr+='-';
}
}
$('#fm_AETypePath').text(pathStr);
}
});
}
});
}
如上,关键代码在onSelect事件中。
以上就是小编为大家带来的easyui中combotree循环获取父节点至根节点并输出路径实现方法全部内容了,希望大家多多支持毛票票~
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短