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

How to point to the most recent (last) data after saving

3 Answers 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
NHJ
Top achievements
Rank 1
NHJ asked on 14 Jan 2020, 07:11 AM
Hello,

No matter what data you add to another grid via a popup, the grid's scrollbar or pager always points to the top or top of the page.


I just want the focus to shift to the data I added.

If data was added at the very end of the scroll, the saved scrollbar should also move to the bottom.

If new data is stored on page 10, I want to go to page 10 and make the data visible immediately.

Is there a way?

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 15 Jan 2020, 02:54 PM

Hello Nam,

 

Out of the box when an item is inserted in the Grid it will be added in the beginning. In order for the item to be on a different position there would be sorting applied for the Grid. 

In order to navigate to a specific item and select it you can use the approach described in the how to article below:

https://docs.telerik.com/kendo-ui/knowledge-base/grid-select-row-on-different-page

 

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.
0
NHJ
Top achievements
Rank 1
answered on 15 Jan 2020, 03:37 PM
Thank you for your response.

I saw this during my guide.

"This approach works only when the Grid uses client-side operations (paging, sorting, filtering). With server operations, the data from pages different than the current one is not available on the client, so you cannot search for the row index. "


I have to use server paging, so I can't follow this guide as it is.

Is there no other way?
0
Viktor Tachev
Telerik team
answered on 17 Jan 2020, 11:45 AM

Hello,

 

When server paging is used only the items for the current page will be returned from the server. Thus, there is no way to calculate the page for a given item on the client-side. 

 

Another option is to handle the DataSource requestEnd event. In the handler check the type of the response and if it is update or create initiate an ajax request. That request will call a server-side method where the page of the new item is calculated. Then call the page() method to make the Grid show the relevant page. The dojo below illustrates the approach:

https://dojo.telerik.com/EbEKuKaH

 

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
NHJ
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
NHJ
Top achievements
Rank 1
Share this question
or