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

Selectednode scrollIntoView do not scroll to the selected node

7 Answers 944 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Anamika
Top achievements
Rank 1
Anamika asked on 08 Sep 2014, 02:59 PM
Hello,

I have a treeview in a splitter and on serach i select the node by id and then shouold scroll the treeview so that the selected node is visible. the selection works but treeview will not scroll atall. i have tried Setting focues as well but it will not move at all.

here is the jquery part for selection amnd then scrolling
​ node = treeview.findByUid(ds.get(path[0]).uid);
treeview.select(node);

treeview.trigger("select", { node: node });
node.scrollIntoView(true);
node.Focus();

Thanks

anamika

7 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 10 Sep 2014, 08:56 AM
Hello Anamika,

See this Dojo snippet for a demo how to use the jQuery scrollTo plug-in, that will provide a smooth interaction.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Anamika
Top achievements
Rank 1
answered on 21 Oct 2014, 02:27 PM
Sorry for re-opening this, but my treeview is inside nested Kendo splitter and data is dynamic and depending on id of node i load all parents and expand and then select the node . So this plug in somehow is not Scrolling the node to view. I could scroll using this alternative way in select Event of treeview
var eleTop = $(e.node).offset().top;
var treeScrollTop = $("#treeview").scrollTop();
var treeTop = $("#treeview").offset().top;
$("#treeview").animate({
scrollTop: (treeScrollTop + eleTop) - treeTop
});

But this is extremely slow and when i manually select a node this is Scrolling it to top as well which i do not Need.
Is there another way to scroll the node to view?
0
Alex Gyoshev
Telerik team
answered on 22 Oct 2014, 08:02 AM
Hello Anamika,

From your message, I could not understand whether the scrolling is slow or not working. Can you provide a snippet that illustrates the problem?

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Anamika
Top achievements
Rank 1
answered on 22 Oct 2014, 08:21 AM
hello,

As you can see i am scrolling the selected node to viewport in OnSelect event of treeview. So there is a lag everytime i select manually a node it will first scroll to top and then the related data is shown in a side grid. I have a search box and when user inputs and click search then only i should be searching the child node and all parent nodes and expandpath and then scroll that node of treeview into view. So as soon as expandpath is expanding if i can scroll to node there it should help. I should not be scrolling in treeview select method as when i manually select a node i should not scroll to view.
Have tried scrollto method as soon as expandpath is called but it will not scroll node to view.

Hope i am clear now.

Thanks

Anamika

0
Alex Gyoshev
Telerik team
answered on 24 Oct 2014, 07:50 AM
Hello Anamika,

Why trigger the scroll in the select event? The select event is triggered when the user clicks the node, not when the API method is called. If the user can click the node, then scrolling to the selected node is not needed. From the app description, it appears that you need to trigger the scrolling when the textbox changes the treeview selection. If that is not the problem, submit a sample to eliminate all guesswork.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Krishna
Top achievements
Rank 1
answered on 12 May 2016, 07:26 PM
I Dojo Snippet you provided above it is does not work if you explicitly set height of "treeview-left" otherwise it works. In my scenario i cannot get by without setting the height. Can you please help?
0
Alex Gyoshev
Telerik team
answered on 13 May 2016, 08:54 AM

Hello Krishna,

Moving the scrollbar to another element requires you to call the scrollTo method on it, when you need it to scroll.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeView
Asked by
Anamika
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Anamika
Top achievements
Rank 1
Krishna
Top achievements
Rank 1
Share this question
or