PDA

View Full Version : How to programmatically focus to an EditorGrid cell.



mcahill81
3 Nov 2009, 5:36 AM
I have an EditorGrid. What I want to do is on the addition of a new row: focus to that cell and have the cell be in editor mode ready for user input.

Thanks
Mike Cahill

3 Nov 2009, 6:26 AM
look at the API for startEditing.

The examples show how to do this btw!


// create the editor grid
var grid = new Ext.grid.EditorGridPanel({
store: store,
cm: cm,
renderTo: 'editor-grid',
width: 600,
height: 300,
autoExpandColumn: 'common', // column with this id will be expanded
title: 'Edit Plants?',
frame: true,
// specify the check column plugin on the grid so the plugin is initialized
plugins: checkColumn,
clicksToEdit: 1,
tbar: [{
text: 'Add Plant',
handler : function(){
// access the Record constructor through the grid's store
var Plant = grid.getStore().recordType;
var p = new Plant({
common: 'New Plant 1',
light: 'Mostly Shade',
price: 0,
availDate: (new Date()).clearTime(),
indoor: false
});
grid.stopEditing();
store.insert(0, p);
grid.startEditing(0, 0);
}
}]
});

mcahill81
3 Nov 2009, 7:07 AM
thank you very much.