Results 1 to 3 of 3

Thread: Load tree nodes from different URLs in Tree panel

  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2008
    Posts
    10
    Vote Rating
    1
      0  

    Question Load tree nodes from different URLs in Tree panel

    Extjs 4.1

    Hi, here is what I want help to achieve:

    1- Load parent nodes by ajax request to a json file e.g. URL of the parent nodes json file is parentNodes.json
    [
    {"id":1,"text":"Node1","url":"","depth":"0","path":"
    Node1/node1Childern.json"},

    {"id":2,"text":"Node2","url":"","depth":"0","path":"
    Node2/node2Childern.json"}
    ]

    2- Once the parent nodes loaded then on parent node expand (when user clicks to expand the parent node) need to load some other nodes as children of the this parent node
    by ajax request to a different json file.

    e.g. URL for Node1 children Node1/node1Childern.json
    [
    {"id":3,"text":"Node1Child1","url":"123.html","depth":"1"},

    {"id":4,"text":"Node1Child2","url":"456.html","depth":"1"}
    ]

    e.g.
    URL for Node2 children Node2/node2Childern.json
    [
    {"id":5,"text":"Node2Child1","url":"abc.html","depth":"1"},

    {"id":6,"text":"Node2Child2","url":"efg.html","depth":"1"}
    ]

    please note that the "path" in parent node used as the path of the json file for child nodes.

    Thanks,

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    You could listen to the beforeload event and change the url
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Ext JS Premium Member
    Join Date
    Sep 2008
    Posts
    10
    Vote Rating
    1
      0  

    Default

    Thanks for the answer,

    In the beforeload event handler I still can't get the expanded node to know what URL to change to, could you please post some example code showing how to capture the node, and I think I need to access the tree store proxy URL config to change it (Ext.data.proxy.Ajax what I'm using).

    Nameer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •