日期:2014-05-16 浏览次数:20288 次
?为树面板添加监听器?
listener:
{
checkchange : function(node, checked) {
???if (checked == true) {
????node.checked = checked;
????// console.dir(node.parentNode);
????//alert(node.get("leaf"));
??? //获得父节点
????pNode = node.parentNode;
? //当checked == true通过循环将所有父节点选中
????for (; pNode != null; pNode = pNode.parentNode) {
?????pNode.set("checked", true);
????}
???}
? //当该节点有子节点时,将所有子节点选中删除
???if (!node.get("leaf") && !checked)
????? node.cascade(function(node){
??? ?node.set('checked', false);
??? ?
??? });
}