1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    11
    Vote Rating
    0
    nitrox83 is on a distinguished road

      0  

    Default Datastore with complex JSONObjects

    Datastore with complex JSONObjects


    How can i extract complex object from a datastore to another datastore?

    My Json data sample as below:

    {"data": [{"listName":"List 1","listItems":[{"item":"Item 1","Quantity":2},{"item":"Item 2","Quantity":4},{"item":"Item 3","Quantity":5}]}]}

    I want to display the above in a fieldset with 1 textfield for the listName and a grid for the listItems, therefore I had managed to read the above data into 1 datastore.

    I was thinking of how I can extract the listItems from the first datastore into another datastore.

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You can copy data to the other store like:

    Code:
    // main app store
    var mainStore = new Ext.data.Store({
    });
     
    // loader store for new data; append records to main
    var loadStore = new Ext.data.Store({
    	listeners: {
    		'load': function(store, records, successful) {
    			mainStore.loadData(records,true); // append records to main
    	}
    });
    Regards,
    Scott.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    11
    Vote Rating
    0
    nitrox83 is on a distinguished road

      0  

    Default


    Thanks got it working

Thread Participants: 1

Tags for this Thread