1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    43
    Vote Rating
    0
    pk.hafeez is on a distinguished road

      0  

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

    Unanswered: 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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,599
    Vote Rating
    434
    Answers
    3102
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You would have to use the appendChild method on a node in the first store.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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