Gago
Gago

Reputation: 35

How row-editing works in extjs 4.2?

Trying to understand how the row-editing works. Here is the example on Sencha website.

So I see that we can edit and save row elements, but can someone explain me step-by-step where the updated/saved columns get stored? And how can I access them?

Also the Sencha demo has the code for row-editing. Thanks much

Upvotes: 1

Views: 8656

Answers (2)

sahul hameed
sahul hameed

Reputation: 11

Pls check this row

var record = e.record;

here event e not define in this function. so change it to eOpts.record to get that record

and

Ext.data.JsonP.request({
                            url: url,
                            params: { record :  Ext.encode( record) } ,
                            success: function(data) {
                                store.load();
                            },
                            failure : function(record, operation) {
                                store.rejectChanges();
                            }
                        });

Upvotes: 0

kevhender
kevhender

Reputation: 4405

Any changes made using the RowEditing plugin are done directly to the model in the store of the grid that you are editing. You can then do as you please with that store to save to the server or wherever else using store.sync();

One common way to save data entered using a row editor is to add an edit listener to your RowEditing plugin config, and make your server call there:

var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
    clicksToMoveEditor: 1,
    autoCancel: false,
    listeners: {
        edit: function(editor, context, eOpts) {
            var record = e.record;
            //do your processing here, e.g.:
            Ext.Ajax.request({
                url: 'myServer/saveRecord',
                params: { record: record }
            });
        }
    }
})

Upvotes: 4

Related Questions