QuadMan
QuadMan

Reputation: 21

extjs ajax proxy updating

I'm started to use ExtJs4 and have question about ajax proxy. My store looks like this:

var users = new Ext.data.Store({
    model: 'User',
    autoDestroy: true,
    autoSync: true,
    autoLoad: true
    proxy: new Ext.data.HttpProxy({
        type: 'ajax',
        api: {
            create: '../users.php?action=create',
            read: '../users.php',
            update: '../users.php?action=update',
            destroy: '../users.php?action=delete'
        },
        reader: {
            type: 'json',
            root: 'users',
            idProperty: 'USRID'
        }
    }),
});

when I remove some records from this store without page refreshing, it seems that all previous deleted items are stored somewhere and sended to php script on every new update. When I refresh page, first remove is ok, but any next remove again accumulate previous removed records. What I do wrong and how I can fix it?

Upvotes: 2

Views: 4984

Answers (2)

sagar
sagar

Reputation: 23

Check the reply you are sending from php page. If you are sending some data that it can't understand as success then it will accumulate previous records. e.g. in Spring make return type void and add attribute @ResponseBody send default ok reply else we need to parse response on client side.

Upvotes: 0

Peter Prins
Peter Prins

Reputation: 21

You might try:

model.commit(); 

http://docs.sencha.com/ext-js/4-0/#/api/Ext.data.Model-method-commit

Upvotes: 2

Related Questions