onKeyDown : adding a new row lets the grid crash
Hello,
I forgot to set the subject in the other post.
Alex, this is realy driving me nuts for weeks.
I have a grid where a new row is added automaticaly when a user presses the "key down" key. This makes the grid a lot userfriendly, because then the user can keep on typing text.
This works fine. When you keep the "key down" key pressed, new rows are even added on the fly. There's only one bug.
- When you're cursor is in a cell from the last row and you press the "key down" key, a now row is added and the focus is moved to the new row.
- When you enter text in a cell from the last row and you press the "enter" key or another key and then the "key down" key, there is no problem. becasue the cell changes from edit mode to non-edit mode. The new row will be added and you can continue working.
- But when you enter text in a cell from the last row and press the "key down" key imediately, a new row will be added, but then the complete grid crashes. Probably becasue the cell was still in edit mode when you pressed the "key down" key and some validating events are fired on the cell.
obj.onKeyDown = function(){
if(obj.getCurrentRow() == (obj.getRowCount()-1)){
obj.addRow();
}
}
Has anybody any idea how to solve this?
Is there a way I can let the grid think I pressed the "enter" key for example?
e.g. : the "key down" key is pressed, then through javascript I let the grid think the "enter" key was pressed as well before the obj.addRow() command is executed.
Thanks!!
I forgot to set the subject in the other post.
Alex, this is realy driving me nuts for weeks.
I have a grid where a new row is added automaticaly when a user presses the "key down" key. This makes the grid a lot userfriendly, because then the user can keep on typing text.
This works fine. When you keep the "key down" key pressed, new rows are even added on the fly. There's only one bug.
- When you're cursor is in a cell from the last row and you press the "key down" key, a now row is added and the focus is moved to the new row.
- When you enter text in a cell from the last row and you press the "enter" key or another key and then the "key down" key, there is no problem. becasue the cell changes from edit mode to non-edit mode. The new row will be added and you can continue working.
- But when you enter text in a cell from the last row and press the "key down" key imediately, a new row will be added, but then the complete grid crashes. Probably becasue the cell was still in edit mode when you pressed the "key down" key and some validating events are fired on the cell.
obj.onKeyDown = function(){
if(obj.getCurrentRow() == (obj.getRowCount()-1)){
obj.addRow();
}
}
Has anybody any idea how to solve this?
Is there a way I can let the grid think I pressed the "enter" key for example?
e.g. : the "key down" key is pressed, then through javascript I let the grid think the "enter" key was pressed as well before the obj.addRow() command is executed.
Thanks!!
Kurt
April 27,