PDA

View Full Version : Inconsistencies between CREATE/UPDATE return-values for DirectStore and Form?



somebee
13 May 2009, 10:43 PM
What is the reason for needing to return only the records themselves (at root-level) in DirectStore (probably all writer-capable stores in general)?

When I update a record in my store, Direct expects a returnvalue like: {id: 3, title: "Test"}. Would it not be better to follow the convention in rest if Ext, with something like:
{success: true, data: {id: 3, title: "Test"}, errors: {...}}

I use the same actions server-side to save forms (for records) and save records in grids. But for forms you need to supply a success: true (for callback etc).

And how would you tell the store about errors on create/update(?) When I try to return {success: true, data: {id: 3, title: "Test"}} to my DirectStore with configured reader/writer (with root: 'data', idProperty: 'id' etc) I get:

Ext.data.DataReader: #realize was called with invalid remote-data. Please see the docs for DataReader#realize and review your DataReader configuration.

savanna
14 May 2009, 2:52 PM
I ran into the same problem today. I think it was working the other way a couple days ago. But today after we updated to the latest svn version, it's working the way you described.

dj
16 May 2009, 4:12 AM
+1 for compatibility between Form submits and Store writes.

There is work going on so that you can throw an exception when an update or create for a record fails: http://extjs.com/forum/showthread.php?t=67484 , http://extjs.com/forum/showthread.php?t=67520

poopsmith
22 Feb 2010, 2:04 PM
DirectStores should be able to back Forms-- the fact that they can't be used that way is a complete travesty. The amount of code I have to write has gone way up. Is there any news on this front? Is this going to be implemented at some point in the future?