1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    19
    Answers
    1
    Vote Rating
    0
    xxhalfpint is on a distinguished road

      0  

    Default Answered: Manipulate data from Proxy before store

    Answered: Manipulate data from Proxy before store


    I have an older service that I can't change.
    It's passing me some data not in array.

    So what I need to do is take the data I'm getting and change it to an array before adding it to the store.
    Example:

    I'm getting from the service in json:
    { "id": "1234",
    "isAdmin": true
    }

    I need to change it to this before it gets stored:
    [{ "id": "1234",
    "isAdmin": true
    }]

    So where would I go about this?
    Right now my proxy looks like this.
    proxy: {
    type:'ajax',
    url: '/service/etc.',
    reader:'json'
    }
    I was thinking Ext.data.proxy.Memory, some guidance with doing this would be great!
    Thanks for the help in advance!!

  2. You can use listeners to determine when to change your data.

    Code:
    listeners: {
        beforeLoad: function(store, operation){ // 1st; no data items
            console.log('beforeLoad');
            console.log(store.data.items);
        },
        dataChanged: function(store){ // 2nd; data items populated, controls still empty
    
            console.log('dataChanged');
            console.log(store.data.items);
        },
        load: function(store, records, success){ // 3rd; data items populate, controls show data
            console.log('load');
            console.log(store.data.items);
        }
    }
    });
    Regards,
    Scott.

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,910
    Answers
    655
    Vote Rating
    443
    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 listeners to determine when to change your data.

    Code:
    listeners: {
        beforeLoad: function(store, operation){ // 1st; no data items
            console.log('beforeLoad');
            console.log(store.data.items);
        },
        dataChanged: function(store){ // 2nd; data items populated, controls still empty
    
            console.log('dataChanged');
            console.log(store.data.items);
        },
        load: function(store, records, success){ // 3rd; data items populate, controls show data
            console.log('load');
            console.log(store.data.items);
        }
    }
    });
    Regards,
    Scott.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi