PDA

View Full Version : grid.startEditing(xmlStore.getCount()-1,0);



j11extjs
10 Oct 2010, 3:34 PM
I have the following code snippet when adding a new record to my grid (always added after the current last row). What I am trying to accomplish is when the new row is added, it starts editing the first cell of that row. However the code snippet below starts editing the 2nd cell of the new row.



var selCell = grid.getSelectionModel().getSelectedCell();
var selRowIndex = selCell[0];
xmlStore.insert(selRowIndex+1, newRecord);
grid.startEditing(xmlStore.getCount()-1,0);
grid.getView.refresh();


Is this a known bug? I can't go negative 1, it doesn't work, as in



grid.startEditing(xmlStore.getCount()-1,-1);


Anybody encountered this and what was your work around? Thank you.

Condor
11 Oct 2010, 1:14 AM
It starts editing the first editable cell. Are you sure your first column is editable?

j11extjs
11 Oct 2010, 1:31 PM
Thank you for the reply.

I don't think it is about the cell being editable because I switched columns and tabbing from the last row, it still created a new row but still starts editing to the 2nd column (column[1], which used to be column[0] before the switch) of the new row. I tried switching with other columns, same result, editing starts at column[1] even though I specify

grid.startEditing(xmlStore.getCount()-1,0);

Condor
11 Oct 2010, 11:18 PM
"column[1], which used to be column[0] before the switch"... Which switch?

Could this be state manager related? Try clearing your path cookie.

j11extjs
12 Oct 2010, 3:20 AM
no, i tried an experiment and switched some of the other columns with column[0] to determine if this original column[0] could have some properties that make it cause an error on grid.startEditing (like for example it being not editable). It turns out that any other column as column[0] causes the same behaviour. (This is in IE8, in Firefox it works and starts editing column[0])