PDA

View Full Version : EditorGrid, changing column afterEdit



olriche38
24 Feb 2010, 2:48 AM
I will know, if it's possible, when I update a cell, afterEdit I will give the focus on another cell on the same row, but with a different Column.

Thx

fay
24 Feb 2010, 4:38 AM
Assuming you want to select/edit the 3rd column, try:


grid.on('afteredit', function(e)
{
grid.startEditing(e.row, 2);
// Alternatively, if you don't want to start editing immediately:
// grid.getSelectionModel().select(e.row, 2);
});

olriche38
24 Feb 2010, 7:55 AM
I don't really understand what you want to do?

fay
24 Feb 2010, 8:17 AM
I don't really understand what you want to do?

/:) mmm, you asked how to focus another cell in afteredit.


grid.getSelectionModel().select(e.row, 2);

will focus another cell.


grid.startEditing(e.row, 2);

will focus another cell and start editing.

I don't think I can be any clearer.

olriche38
24 Feb 2010, 8:29 AM
grid.getSelectionModel().select(e.row, 2);Doesn't work!

Because, select is not a function

fay
24 Feb 2010, 8:36 AM
select is not a function
It is if you are using the CellSelectionModel (with the EditorGridPanel) as I assumed given your query.

olriche38
24 Feb 2010, 11:51 PM
In fact, I define my grid EditorPanel with that :


var listingEditorGrid = new Ext.grid.EditorGridPanel

I can do this :

listingEditorGrid.on('afteredit', function(e){
listingEditorGrid.startEditing(3, 7);
});

But the row is no really the good one, if I push enter to validate my cell.

But this code doesn't work with that:

listingEditorGrid.on('afteredit', function(e){
listingEditorGrid.CellSelectionModel().select(e.row, 1)
});

Because CellSelectionModel is no a function of listingEditorGrid

fay
25 Feb 2010, 3:47 AM
If you read the documentation for Ext.grid.EditorGridPanel (http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.EditorGridPanel), you'll see that the selModel defaults to Ext.grid.CellSelectionModel (http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.CellSelectionModel) if not otherwise specified. And, CellSelectionModel contains a select() method.

Your code:


listingEditorGrid.CellSelectionModel().select(e.row, 1)

is incorrect. It should be:


listingEditorGrid.getSelectionModel().select(e.row, 1);

If this doesn't work, then post a short working showcase (http://www.extjs.com/learn/Ext_Forum_Help#Posting_a_working_showcase).