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

[Solved] Scroll row/Detail template when expanded?

9 Answers 858 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jeff
Top achievements
Rank 1
jeff asked on 03 Dec 2014, 09:30 PM
Two things; can I allow only one detail template expanded at a time AND when it's expanded, can I scroll the row/detail template to the top of the scroll area?

Thank you!

j

9 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 05 Dec 2014, 03:38 PM
Hi Jeff,

You can keep only one row expanded using the grid "detailExpand" event in which to check if there are other expanded rows to collapse them - please check the example below:

Also you can scroll to given row by getting it's "top" position using jQuery and passing the value to the"scrollTop" method (called from the grid "content" element).

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
jeff
Top achievements
Rank 1
answered on 05 Dec 2014, 06:20 PM
Perfect, thank you very much!
0
jeff
Top achievements
Rank 1
answered on 12 Dec 2014, 01:02 AM
Hi Vladimir,
Thank you, using the detailExpand event worked great; I'm still trying to use it to to scroll the containing 'tr' to the top of the container (.k-grid-content), but still no luck; any tips here?
0
Vladimir Iliev
Telerik team
answered on 15 Dec 2014, 11:18 AM
Hi Jeff,

Could you please provide runable example with the current implementation of the "scroll to row" feature? This would help us get better overview of your current setup and advice you better how to proceed.

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
jeff
Top achievements
Rank 1
answered on 29 Jan 2015, 12:56 PM
Hi Vladimir!
Finally back on this! This is what I'm trying to use to get the row to the top:

function detailInit(e) {
  var detailRow = e.detailRow;
  this.element.find(".k-grid-content").animate({
    scrollTop: this.select().offset().top
  }, 400);
}

..it's scrolling the entire page to top; what am I missing? Thank you!
0
Atanas Korchev
Telerik team
answered on 02 Feb 2015, 08:51 AM
Hi,

We cannot reproduce this problem. Could you please update the demo we've sent you so it starts to behave as in your case?

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
jeff
Top achievements
Rank 1
answered on 02 Feb 2015, 02:08 PM
Hi,
Yes, the dojo for displaying only one row expanded was very helpful. However, it was a two-part question, and I haven't figured out a way to get the row displaying the expanded detail template to scroll to the top:

function detailInit(e) {  
var detailRow = e.detailRow;  
this.element.find(".k-grid-content").animate({    
scrollTop: this.select().offset().top  
}, 400);}

..it's scrolling the entire page to top; what am I missing? Thank you!













0
Atanas Korchev
Telerik team
answered on 02 Feb 2015, 02:18 PM
Hello,

We are not sure what is missing because we don't know how to reproduce the problem. Please update the dojo so it shows the issue that you are having.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
jeff
Top achievements
Rank 1
answered on 04 Feb 2015, 06:03 PM
Figured it out; it kept traversing right past the container and scrolling to the top of page, etc.., so I did this:

01.function detailInit(e) {
02.    var detailRow = e.detailRow;
03.    var scrollContentOffset = this.element.find("tbody").offset().top;
04.    var selectContentOffset = detailRow.offset().top;
05.    var distance = selectContentOffset - scrollContentOffset - 29; //the '29' is the height of the row so it is also displayed.
06. 
07.    //    animate the scroll
08.    this.element.find(".k-grid-content").animate({
09.        scrollTop: distance
10.    }, 400);
11.}

Thank you!
Tags
Grid
Asked by
jeff
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
jeff
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or