1. #1
    Ext JS Premium Member
    Join Date
    Sep 2008
    Posts
    10
    Vote Rating
    1
    extdev22 is on a distinguished road

      0  

    Question Unanswered: Load tree nodes from different URLs in Tree panel

    Unanswered: 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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You could listen to the beforeload event and change the url
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Sep 2008
    Posts
    10
    Vote Rating
    1
    extdev22 is on a distinguished road

      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

Thread Participants: 1