Extjs tree 實現父節點和子節點聯動

2021-05-24 04:37:50 字數 1634 閱讀 9359

//   loader : new ext.tree.treeloader(),

root : new ext.tree.asynctreenode(),

loader : new ext.tree.treeloader(

}),listeners:

else ;

var parentnode = node.parentnode;

if(parentnode !== null)

node.expand();

node.attributes.checked = checked;   

node.eachchild(function(child) 

});

//      this.childchecked(node,checked);

/*if (!index_category_checking) */ }}

}, config));

},childhaschecked :function(node),

parentcheck:function(node,checked)

}, checkchild:function(node,checked)else

//child.on('checkchange',function(node, checked));  

//child.fireevent('checkchange', child, checked);  

});},

checkparent:function(node)             

var parentnode = node.parentnode;  

if(parentnode !== null)                     

});  

if(isall)else  

}else 

this.checkparent(parentnode);//遞迴  

}, childchecked:function(node,checked));  

}else 

})(node);  

// 父變為true,父的父(如果有的話)也應該都為true  

(function(node) else 

})(node);  

}else );  

}else 

})(node);  

// 父變為false,但父的父(如果有的話)不一定變化  

(function(node)   

});  

if (chk == true) else   

}else 

})(node);  

}  

index_category_checking = false;  

}}, 

link : function(roleid, permissioncode)

});},

unlink : function(roleid, permissioncode)

});}

});ext.reg('relation.role2permission.tree', eway.relation.role2permission.tree);

JS獲取子節點 父節點和兄弟節點

js獲取父節點 js獲取兄弟節點 var a document.getelementbyid test getelementsbytagname div 陣列格式,不包含換行和空格 var getfirstchild document.getelementbyid test children 0 陣...

遞迴獲取當前節點和所有父節點

listlistparentgolder new list 獲取當前節點和所有父節點 private mymanagefolderinforesponse getparentfolder mymanagefolderinforesponse mymanagefolderentity,listlist...

獲得父節點

treepath path selectionmodel.getselectionpath defaultmutabletreenode node defaultmutabletreenode path.getlastpathcomponent treepath parentpath path.ge...