现在的位置: 首页 > 综合 > 正文

Extjs选中当前节点后自动选中子节点和父节点

2013年10月17日 ⁄ 综合 ⁄ 共 405字 ⁄ 字号 评论关闭
//根据当前节点选中父节点及其子节点 
    tree.on('checkchange', function(node, flag) { 
//获取所有子节点 
node.cascade( function( node ){ 
   node.attributes.checked = flag; 
   node.ui.checkbox.checked = flag; 
   return true; 
    }); 
   //获取所有父节点 
      var pNode = node.parentNode; 
      for(; pNode.id !="root"; pNode = pNode.parentNode ){ 
       if (flag || tree.getChecked(id, node.parentNode) == "") { 
            pNode.ui.checkbox.checked = flag; 
            pNode.attributes.checked = flag; 
      }   
      } 
}); 


来源:http://qinya.javaeye.com/blog/695394

抱歉!评论已关闭.