View Full Version : how can i update a record in Grid ?

29 Jan 2012, 6:35 AM
why when i press update button on my row-editor plugin's Grid , it call insert operation and send my request to create operation of CRUD ?

29 Jan 2012, 1:32 PM
are you assigning an ID to your records? An 'id' field of type 'int' is required in the store's model:

// Example (copied partly from API Docs)
Ext.define (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext-method-define)('User', {
extend: 'Ext.data.Model (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.data.Model)',
fields: [
{name: 'id', type: 'int'},
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'}

If you arent assigning a unique id to your records, this might be causing a problem. Otherwise update should work.

29 Jan 2012, 3:40 PM
There are some ways to resolve your problem:

Set autoSync of grid store to true. This way, each time the grid is changed by adding or editing or deleting, the grid store will auto sync with your server.
Capture the 'edit' event of editor and then call the <gridStore>.sync(), where gridStore is your grid store.
Hope this will help.