Start edit with rowediting after a new record has been added to a store with autosync on

StackOverflow https://stackoverflow.com/questions/23421464

  •  13-07-2023
  •  | 
  •  

Question

We thought this to be simple by using these lines in our controller

store.on('write',function(s,o){ editor.startEdit(record, 0); },me,{ single:true });
store.insert(0,record);

but it doesn't work. Meaning; the record get save, no error appears but the rowediting doesn't start.

We have a slightly modified version of buffered store which allow us to perform CRUD operations with it. Doing the same there opens the editor plugin.

So how can we automatically start editing a row (and at best scroll to it first - see this question) right after a inserted record was successfully written to the server?

Était-ce utile?

La solution

You might be facing a timing issue where your row still has the autoId created by the model and is yet not updated with the new Id provided by your server side. Because your Model is already updated the editor is not able to find the row you wants to edit and will abort.

Try to call the editor defered by using Ext.Function.defer

It may be worth a try.

Autres conseils

To scroll to the newly added row, you have to call focusRow on the grid's view.

myGrid.getView().focusRow(row) see http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.view.Table-method-focusRow for details.

What is your store's batchUpdateMode? I think the write event is fired only if the batchUpdateMode is operation (default value). Otherwise you can listen to datachanged event.

Hope this works for you.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top