I add a new empty row to dojox.grid.DataGrid and want to focus in the first cell of the new row.
I add a line by calling:
var new_row = {}, attributes = store.getAttributes( items[0] ); dojo.forEach( attributes, function( attribute ) { dojo.forEach( attributes, function( attribute ) { new_row[ attribute ] = null; } ); } ); store.newItem( new_row );
I believe the following code will do the focus:
grid.focus.setFocusIndex( row_index, 0 ); grid.edit.setEditCell( grid.focus.cell, row_index );
But I canβt understand how to call this code only after re-rendering the grid. I think I need to connect to the event. However, I do not see a likely event to use. onNew () seems to be called before a new line is added.
Here's a JSFiddle that comes as close to the solution as possible. http://jsfiddle.net/xDUpp/ (comment out the highlighted line and add a new line)
thanks
source share