Results 1 to 4 of 4

Thread: ExtJS 4.x Multiple treestores from a single read

  1. #1
    Sencha Premium Member
    Join Date
    Apr 2012
    Location
    Napier, New Zealand
    Posts
    8

    Default Answered: ExtJS 4.x Multiple treestores from a single read

    I have a situation where I want to create three treepanels from data that is available from a single proxy read. The result of the read is in the form: { root1:[], root2:[], root3:[] }

    I have created a parent (ordinary) store to hold this data and I can see how I can populate other ordinary stores using:

    ordinaryStore1.loadRawData(store.proxy.reader.jsonData.root1);

    However, I can find no equivalent method to do the same with treestores.

    At the moment I am just using three separate reads which works fine but is far from elegant. Can anyone suggest what it is I am missing or perhaps suggest an entirely different approach.

    TIA Alan

  2. I'd try to call appendChild on 2nd and 3rd tree root with data from root2 and root3.

  3. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Answers
    512

    Default

    I'd try to call appendChild on 2nd and 3rd tree root with data from root2 and root3.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  4. #3
    Sencha Premium Member
    Join Date
    Apr 2012
    Location
    Napier, New Zealand
    Posts
    8

    Default

    Thank you jsakalos.

    I actually ended up using setRootNode in the form:

    root1.setRootNode({ children: store.proxy.reader.jsonData.root1 });

    but I needed your response to push me in the right direction.

  5. #4
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Answers
    512

    Default

    Yes, setRootNode is also fine. The difference is that it sets everything root+childrend. For appendChild you set only children to the existing root.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


Tags for this Thread

Posting Permissions

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