extjs 树前面的多选框选中状态修改

在treepanel的事件中添加:

 1                    listeners: {
 2                            
 3 //                            itemdbclick:{                            
 4 //                                fn: function(view, record, item, index, e,obj){
 5 //                                    alert('dbclick');e.stopEvent;
 6 //                                },
 7 //                                scope: this
 8 //                            }
 9 //                            ,
10 //                             itemclick: {
11 //                                    fn: function(view, record, item, index, e,obj){
12 //                                            alert(record.data.id+':'+record.data.text);
13 //                                            e.stopEvent;
14 //                                        },
15 //                                    scope: this
16 //                            },
17                             checkchange: {
18                                 fn: function(node,checked,obj) {
19 
20                                       if(checked)
21                                       {
22                                           var pNode = node.parentNode;
23                                           for(;pNode!=null;pNode=pNode.parentNode)
24                                           {
25                                             pNode.set('checked',checked);
26                                           }
27                                       }
28 
29                                       if(node.childNodes.length>0)
30                                       {
31                                          node.cascade(function(node){
32                                             node.set('checked',checked);
33                                          });
34                                       }
35 
36                                 }
37                             }
原文地址:https://www.cnblogs.com/baishahe/p/2514984.html