I am adding a new blank row to a dojox.grid.DataGrid, and want to focus in the first cell of the new row.
I add the row 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 focusing:
grid.focus.setFocusIndex( row_index, 0 );
grid.edit.setEditCell( grid.focus.cell, row_index );
But I cannot figure out how to only call this code after the grid has re-rendered. I guess I need to connect to an event. However, I can't see a likely event to use. onNew() seems to be called before the new row is added.
Here's a JSFiddle which gets as close as I can to a solution. http://jsfiddle.net/xDUpp/ (comment out the line marked edit and it adds the new row)
Thanks