View Full Version : EditorGridPanel select cell from code error

22 Sep 2009, 2:46 PM
I'm trying to select cell 0,0 automatically when the grid loads so that the I can start moving around in the cells without having to use the mouse to select the first cell.

I have tried debugging this using Firebug and following the stack trace but it's not helping me a lot. Can anyone tell me how to fix this so I can pre-select cell 0,0 of the grid?

I'm using CellSelectionModel and this code.

listeners: {
afterrender: function(grid) {

grid.getSelectionModel().select(0, 0);
The code is throwing this error.

this.getRow(row) is undefined
[Break on this error] return this.getRow(row).getElementsByTagName('td')[col]; ext-all-debug.js (line 60813)

9 Oct 2009, 12:57 PM
I'm going to bump this as I still have not figured out why the CellSelectionModel has a select(Number rowIndex, Number colIndex, [Boolean preventViewNotify], [Boolean preventFocus]) method which always throws an error.

The error also looks like it would be more relevant to the RowSelectionModel.

I would really like to be able to set a default cell selection when the grid loads. Can someone please help me with this?

9 Oct 2009, 1:03 PM
Yeah, I have finally got this working. Of course it comes to me right after posting the question again. I love how it just happens that way some times.

The cell select has to happen after the load of the store so I used this.

this.grid.getStore().on('load', function(store, records, options) {
this.grid.getSelectionModel().select(0, 0);
}, this);