This is a migrated thread and some comments may be shown as answers.

Insert new row and position cursor in the first editable field when TAB key is pressed

2 Answers 199 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vasile
Top achievements
Rank 1
Vasile asked on 31 Mar 2021, 02:54 PM

Hi,

I have the next task to solve.
For Incell editing if the cursor is on the last row in the last editable field and the TAB key is pressed, a new row must be added as the last row and the cursor must be positioned in the first editable field of this row. The data source for the grid is of the ObservableCollection<> type.

I tried to write code on the OnUpdate and OnStateChanged events but without reaching the desired result.

Any help is welcome.

 

Vasile Lacatus

Advanced Software Solutions

2 Answers, 1 is accepted

Sort by
0
Vasile
Top achievements
Rank 1
answered on 31 Mar 2021, 03:29 PM
Note: I do not need paging or grouping in the grid.
0
Marin Bratanov
Telerik team
answered on 01 Apr 2021, 12:54 PM

Hello Vasile,

The general approach would be to add a new item to the grid data source and after that put it in edit mode through the grid state (see the Initiate Editing or Inserting of an Item section). Perhaps you can try this in OnUpdate, but keep in mind that after it, the grid will re-render, so you may need to use Task.Run() to add a delay to change the grid state until after the re-render has happened (usually 50-100ms should suffice). If you do make such a sample, feel free to open a pull request in this repo to share it with the community, we award such contributions with Telerik points.

 

Regards,
Marin Bratanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Vasile
Top achievements
Rank 1
Answers by
Vasile
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or