日期:2014-05-16  浏览次数:20293 次

ExtJs4.0 TreePanel+CheckBox全选 .

  1. var?mytree?=?new?Ext.tree.TreePanel({??
  2. ????id:?'ppdTree',??
  3. ????x:?5,??
  4. ????y:?5,??
  5. ????width:?378,??
  6. ????height:?470,??
  7. ????useArrows:?true,??
  8. ????autoScroll:?true,??
  9. ????animate:?true,??
  10. ????enableDD:?true,??
  11. ????containerScroll:?true,??
  12. ????store:?new?Ext.data.TreeStore??
  13. ????????????????({??
  14. ????????????????????proxy:??
  15. ????????????????????{??
  16. ????????????????????????type:?'ajax',??
  17. ????????????????????????url:?'data/User/UserPopedom.aspx?parameter=ppdTree&userId='?+?userId??
  18. ????????????????????},??
  19. ????????????????????root:??
  20. ????????????????????{??
  21. ????????????????????????id:?0,??
  22. ????????????????????????text:?"选择权限",??
  23. ????????????????????????leaf:?false,??
  24. ????????????????????????expandable:?true,??
  25. ????????????????????????expanded:?true??
  26. ????????????????????},??
  27. ????????????????????sorters:?[??
  28. ????????????????????{??
  29. ????????????????????????property:?'leaf',??
  30. ????????????????????????direction:?'ASC'??
  31. ????????????????????},??
  32. ????????????????????{??
  33. ????????????????????????property:?'text',??
  34. ????????????????????????direction:?'ASC'??
  35. ????????????????????}]??
  36. ????????????????})??
  37. });??
  38. mytree.on('checkchange',?function?(node,?checked)?{??
  39. ????node.expand();??
  40. ????node.checked?=?checked;??
  41. ????node.eachChild(function?(child)?{??
  42. ????????child.set('checked',?checked);??
  43. ????????child.fireEvent('checkchange',?child,?checked);??
  44. ????});??
  45. },?mytree); ?