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.
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?
Thank you very much for your answers. I already tried to add a timeout, but that didn't work.
But the solution from Carlos worked perfectly. The grid crashed because of the missing row count, perhaps in combination with the timeout.
Thanks again!! You realy saved me from a nervess brakedown.