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

Ajax Request on editor using set on navigatable grid always focus first cell

1 Answer 14 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 12 Jun 2019, 08:51 AM

I have the need to perform ajax request when editing, and update some of grid values. When grid is navigetable , after using set on a row ( after the editor closed ) the grid looses current editing position and goes to first cell.

https://dojo.telerik.com/UQEMOWiC/3

In this example I have an editor of numerictextbox, I have a change function which sets values for 2 other fields but I use timeout to set them.

When I do that it always focuses the first cell which is not a behavior I want.

The reason I use setTimeout in my example is to simulate a server operation before setting the values so I need a little delay, which means that the editor has already closed thus the resulted behavior.


1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 14 Jun 2019, 07:34 AM
Hi John,

By default when the Grid is data bound the first cell in the grid content will be focused. In order to keep the focus on the same cell after the Grid data has been updated you can handle the edit event and cache the index of the edited cell and the row where the cell is. Then use the dataBound event to restore the focus to the cell using the current method.

The updated dojo below illustrates the approach:


Give it a try and let me know how it works for you.


Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or