ExtJs4.0 TreePanel+CheckBox全选 .



ExtJs4.0 TreePanel+CheckBox全选 .

  • var mytree = new Ext.tree.TreePanel({
  •     id: ’ppdTree’,
  •     x: 5,
  •     y: 5,
  •     width: 378,
  •     height: 470,
  •     useArrows: true,
  •     autoScroll: true,
  •     animate: true,
  •     enableDD: true,
  •     containerScroll: true,
  •     store: new Ext.data.TreeStore
  •                 ({
  •                     proxy:
  •                     {
  •                         type: ’ajax’,
  •                         url: ’data/User/UserPopedom.aspx?parameter=ppdTree&userId=’ + userId
  •                     },
  •                     root:
  •                     {
  •                         id: 0,
  •                         text: ”选择权限”,
  •                         leaf: false,
  •                         expandable: true,
  •                         expanded: true
  •                     },
  •                     sorters: [
  •                     {
  •                         property: 'leaf',
  •                         direction: 'ASC'
  •                     },
  •                     {
  •                         property: 'text',
  •                         direction: 'ASC'
  •                     }]
  •                 })
  • });
  • mytree.on(‘checkchange’, function (node, checked) {
  •     node.expand();
  •     node.checked = checked;
  •     node.eachChild(function (child) {
  •         child.set(‘checked’, checked);
  •         child.fireEvent(‘checkchange’, child, checked);
  •     });
  • }, mytree);