Results 1 to 2 of 2

Thread: How to load data in to one tree store(Memory proxy) from another tree store reader

  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    43
    Vote Rating
    0
      0  

    Default How to load data in to one tree store(Memory proxy) from another tree store reader

    Hi,

    I have couple of tree panels, each configured with individual tree stores. I have configured a proxy for one store. on load event of this, i am trying to load the second store(proxy memory) like below. But doesn't work.

    _treeStore2 = Ext.create('Ext.data.TreeStore', {
    model: 'Scenario',
    proxy : {
    type : 'memory'
    }

    });

    _treeStore1 = Ext.create('Ext.data.TreeStore', {
    model: 'Scenario',
    root:'data1',
    proxy : {
    type : 'ajax',
    url: '/proj/examples?id='+_Id,
    reader : {
    type : 'json',
    root:'data1'
    }
    },
    listeners: {
    'load': {
    fn: function(store, records, success, operations) {
    _treeStore2.setRootNode(_treeStore1.getProxy().getReader().jsonData.data2);
    }
    }
    });

    Sample JSON data: {"data1":[{"name":"value","children":[]}],"data2":[{"name":"value","children":[]}]}

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Answers
    3976
    Vote Rating
    1367
      0  

    Default

    You would have to use the appendChild method on a node in the first store.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

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