View Full Version : HTTPProxy execute update only when certain fields change

7 Jan 2011, 1:57 AM
Hi there,

I have created an editable Grid that has a Store with a HttpProxy, in my Reader I set several fields: id, name, date, progress.
I want to update only when id name or date changes and not when the progress changes, actually the progress is not editable, is just a field where I show info of the progress of a task being performed in the background but when it refreshes the update is being executed (so a request is thrown) and this is something I don't want, is there any way of getting an api action performed only for some fields?

This is my Store code:

var projectsStore = new Ext.data.Store(
proxy: new Ext.data.HttpProxy(
url: projectServlet,
create: projectServlet + '?action=createProject',
update: projectServlet + '?action=updateProject',
destroy: projectServlet + '?action=deleteProject'
reader: new Ext.data.JsonReader(
root: 'items',
id: 'id',
{name: 'id', allowBlank : true},
{name: 'name', allowBlank : false},
{name: 'date', allowBlank : true},
{name: 'progress', allowBlank : true}
writer: new Ext.data.JsonWriter({writeAllFields: true})
});And I update the progress by doing:

var data = getDataFromServer();
var row = projectsStore.getById(data.id);
row.set('progress', data.progress);
So after this the progress will show the new value but I don't want to execute the update action from the Proxy.

Any help would be very appreciated.

7 Jan 2011, 2:47 AM
row.data.progress = data.progress;
but this won't refresh any linked component.

If you want that, you also need:

row.store.fireEvent('update', row.store, row, Ext.data.Record.EDIT);

7 Jan 2011, 3:04 AM
Hey Condor, Thanks for the quick reply and thanks for the solution, now I have it working :)