To successfully use Grid, auto sync store, and rowediting plugin in ExtJS 4, there are several points need to be highlighted. I listed them as below,
- In your Model class, you have to either define a hardcoded 'id' property or use 'idProperty' to specify one column as 'id'.
- You server side code need to return processed records back to browser. I tried only send back "id" in "data" part. But, it is not successful.
- Be aware that the format of record in the "data" has JSON format.
- Be sure to implemented at least one Validator in your Model class because, in ExtJS source code
AbstractStore.js
, you can find the following code, which may always return true for a new created record in RowEditing plugin when the store is set asautoSync = true
/** * @private * Filter function for new records. */ filterNew: function(item) { // only want phantom records that are valid return item.phantom === true && item.isValid(); },
Most likely, we wont use auto sync store in real product. But, this example could be a good start.
There's an example of using the remoting interface of Ext.direct in the examples. Look in the 'direct' folder. The remoting provider uses JSON to transport values to and from the server using an RPC-like architecture. This way you are using an 'object' interface to server classes.
ReplyDeleteThere's also an example of using the REST in the restful folder.
I found these really useful.