3

In my grid I have added a row editor as plugin (with new Ext.ux.grid.RowEditor()). I want to set focus on a specific column in a specific record.

This is what I have now: editor.startEditing(record);;

It starts editing and sets focus on the first field, but I want to define a different field. Searching the web I see people having something like: editor.startEditing(record, column) or editor.startEdit(record, column) the first doesn't seem to work and the latter function does not exist.

The solution could rely in a 'RowEditing' plugin but since ExtJs is new to me I don't understand how to do that.

Any help is very much appreciated.

user618505
  • 31
  • 1
  • 3

2 Answers2

4

I am using a grid with a Row Editor in ExtJS 4.0.2 and I programatically add a row and start editing it with this code:

var editor = grid.getPlugin('myRowEditor');
grid.getSelectionModel().select(lastRowCounter);   //0 based selector.
editor.startEdit(lastRowCounter,1);  //start editing on Second column.
dbrin
  • 15,525
  • 4
  • 56
  • 83
  • I made a mistake by assuming it was ExtJs 4, but it is 3.4 actually. Thanks anyway for your answer, it made me realize that. I still don't know how to solve my problem but have to start over looking for a solution. – user618505 Feb 25 '12 at 12:29
4

Before wasting time with programming by trying, I recommend you to read sources.

From RowEditor: startEditing: function(rowIndex, doFocus). So there is a second param, but is not an index. If you read onRowDblClick you will find that they first call startEditing disabling focus, and then they handle the cell to focus with doFocus.

By the way, doFocus depends on a DOM event (where the user clicked). If you don't have such events, you can just take some inspiration from that function: they just call focus() on the column editor, obtained from ColumnModel#Column#getEditor().

Francesco
  • 454
  • 1
  • 3
  • 12
  • Thanks. In 2016 and your words I ended up using http://docs.sencha.com/extjs/6.0.1/classic/src/CellEditing.js.html#Ext.grid.plugin.CellEditing-method-startEditByPosition – Christiaan Westerbeek Sep 22 '16 at 11:19