Pregunta

After sync() updating just that one row that is changed but not all from response.

Model:

Ext.define('Exp.model.ProfileChannel', {
    extend: 'Ext.data.Model',
    fields: ['id', 'channel', 'server', 'profile'],

    proxy: {
        type: 'ajax',
        api: {
            read: '/profilechannel/list',
            update: '/profilechannel/save'
        },
        reader: {
            type: 'json',
            root: 'data'
        }
    }
});

Store:

Ext.define('Exp.store.ProfileChannels', {
    extend: 'Ext.data.Store',
    model: 'Exp.model.ProfileChannel',
    autoSync: true
});

Lets say in store i have record like this:

{
    id: '1',
    profile: 'profile id',
    channel: '',
    server: ''
}

then after: record.set('channel', 'channel id');

response:

{
    "success":true,
    "data":[
        {
            id: '1',
            profile: 'profile id',
            channel: 'channel id',
            server: 'server id added on backend'
        }
    ]
}

And in the end I have record like this:

{
    id: '1',
    profile: 'profile id',
    channel: 'channel id',
    server: ''
}

So the problem is how can I update and server value I have new value in response.. is that a bug? or I am doing it wrong? why should I put all properties if extjs ignoring them?

¿Fue útil?

Solución

It should behave exactly how you expect it to. All records returned from the store after update procedure should replace local copies you might already have in the store. You might want to check ExtJs code and debug it to see what's wrong.

I definitely use same logic with ExtJs 4.0.7. It's possible something is broken it 4.1, or may be you need to adjust some configuration in your store/proxy.

Otros consejos

i also had the some problem that records didnt updated on 4.1. after some debugging i found out that all extjs model fields need to return in the server response!

extjs didnt throw any error, only the failure callback on store.sync() and record.save() throw me an error. it was hard to find...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top