Extjs4 Study Notes (20)-treepanel instance

Source: Internet
Author: User

With the release of the fifth preview version of extjs4, more instances are released. This article introduces the use of extjs4 treepanel. This instance is from the extjs official website. This instance does not limit the drag and drop of Tree nodes. In this example, treestore and ajaxproxy are used.

HTML code:

 
  1. <Div id = "tree-Div" style = "width: 250px; Border: 1px solid # c3daf9;"> </div>

JS Code:

 
  1. Ext. Require ([
  2. 'Ext. Tree .*',
  3. 'Ext. Data .*'
  4. ]);
  5. Ext. onready (function (){
  6. VaR store = new Ext. Data. treestore ({
  7. Proxy :{
  8. Type: 'ajax ',
  9. URL: 'Get-nodes. php'
  10. },
  11. Root :{
  12. Text: 'ext js ',
  13. ID: 'src ',
  14. Expanded: True
  15. },
  16. Sorters :[{
  17. Property: 'leaf ',
  18. Direction: 'asc'
  19. },{
  20. Property: 'filename ',
  21. Direction: 'asc'
  22. }]
  23. });
  24. VaR tree = new Ext. Tree. treepanel ({
  25. // Autoscroll: True,
  26. // Enabledd: True,
  27. // Containerscroll: True,
  28. Animate: True,
  29. Border: false,
  30. Store: store,
  31. Viewconfig: {plugins: [{ptype: 'treeviewdd'}]},
  32. Renderto: 'tree-Div ',
  33. Height: 300
  34. });
  35. });

In this example, the returned data is in JSON format and the server must return data similar to the following:

 
  1. [{"Text": "layout", "ID": "src \/layout", "CLS": "folder" },{ "text": "componentquery. JS "," ID ":" src \/componentquery. JS "," leaf ": True," CLS ":" file "},{" text ":" Draw "," ID ":" src \/draw ", "CLS": "folder"}]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.