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,627
    Answers
    612
    Vote Rating
    399
    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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar