PDA

View Full Version : [SOLVED] [3.0rc1.1] Writer problem



Andrea_P
5 May 2009, 4:26 AM
Hi,
I'm new to Ext.. I wrote the following code:



store = new Ext.data.Store({
url: "-----.php",
baseParams: {limit:100},
remoteSort: true,
reader: new Ext.data.JsonReader({
totalProperty: "totalCount",
root: "records",
idProperty: "id",
successProperty: "success"
},Keyword
),
writer: new Ext.data.JsonWriter({
returnJson: true,
writeAllFields: false
},Keyword
)
}),
When I update the row with the writer I send from the server this:



{"success":true}But I have this error:

DataReader#update received invalid data from server. Please see docs for DataReader#update

what's wrong?? Thanks

Andrea

Condor
5 May 2009, 4:40 AM
A writer update should return an object with the new record values.

Andrea_P
5 May 2009, 5:07 AM
solved returning this:



{"success":true,"records":{"id":"2694",....}}

thanks!

christocracy
11 May 2009, 12:10 PM
Andrea, you don't have to return the entire record but you must return at least the id. The DataReader will merge any incoming new data from server with existing data on the record. However, I think it's always a good idea for the server to re-assert its authority over the data on the client.

Quite often, one might have a grid with an "Updated at" column. You'd want that column to be refreshed after each update. See thumb.