1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    15
    Vote Rating
    0
    fvinson is on a distinguished road

      0  

    Default data json store

    data json store


    I have a data store from json
    Code:
        //Data Composition Reaction
        Ext.define('ReactionCompoModel', {
            extend: 'Ext.data.Model',
            fields: [{name:'leftR',type:'string'},{name:'rightR',type:'string'}]    
        });
        var storeReactionCompo = Ext.create('Ext.data.JsonStore', {
            model: 'ReactionCompoModel',
            proxy: {
                type: 'ajax',
                url: '../php/datareactioncompo_v2.php',
                extraParams: {idReaction:0},
                reader: {type: 'json' }
            }
        });

    i want to recover the data
    Code:
               storeReactionCompo.proxy.extraParams.idReaction= idReaction;
               storeReactionCompo.load();
               console.log(storeReactionCompo.getById(leftR));
    the storeReactionCompo.load return :

    [{"leftR":"substrat1 + substrat2","rightR":"Product1 +Product2"}]

    storeReactionCompo.getById('leftR') give result : null
    storeReactionCompo.get('leftR')); give storeReactionCompo.get is not a function

    I don't anderstand ; How can i get the value substrat1 + substrat2 ?

    Thank you

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,866
    Vote Rating
    438
    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 use the following"

    Code:
    store.load({
    	callback: function(records, operation, success){
    		console.log(records);
    		console.log(records[0].get('name')); // multiple records; array based return
    	}
    });
    You can use convert to create calculated values or perform this at the server.
    http://docs.sencha.com/ext-js/4-1/#!...ld-cfg-convert

    Scott.

Thread Participants: 1