Adding rows in angular data grid, how to choose what column gets focused when entering edit mode? #12500
-
Is it possible to control which column that gets focused when entering edit mode after pressing add row button? ex:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @Ugla-Bugla, I have been looking into your question and in order to achieve these requirements, what I suggest as an approach is to make all columns before the one from which you want to start editing and adding a row non-editable with editable property of igx-column component set to false.
Thus, when adding or editing a row, it will start from the first column that is editable. After that you will handle the rowEditEnter and rowEditExit events. When editing or adding a row and when the rowEditEnter event is fired, you will set those columns that are non-editable back to editable so that you can add or edit values in these cells.
And when exiting from editing or adding a row, when rowEditExit event is fired, you will again set the same columns to non-editable so that when these events are performed next time, they can start again from the column that is according to your requirements.
In addition, I have prepared small sample illustrating this behavior which could be found here. Please test it on your side and let me know how it behaves. The described scenario could be observed here: |
Beta Was this translation helpful? Give feedback.
-
While this do work, it feels kinda like a hack tbh. It would be great to have an input on the grid with the name of the field which should get focus when edit starts. |
Beta Was this translation helpful? Give feedback.
Hi @Ugla-Bugla,
I have been looking into your question and in order to achieve these requirements, what I suggest as an approach is to make all columns before the one from which you want to start editing and adding a row non-editable with editable property of igx-column component set to false.
Thus, when adding or editing a row, it will start from the first column that is editable.
After that you will handle the rowEditEnter and rowEditExit events. When editing or adding a row and when the rowEditEnter event is fired, you will set those columns that are non-e…