Home - Forums-.NET - FlyTreeView (ASP.NET) - how to scroll to selected node?

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

how to scroll to selected node?
Link Posted: 24-Mar-2011 11:32
Is there any way to get FlyTreeView to automatically scroll to the selected node?
I've got a FlyTreeView with a height that's set and a lot of elements.

In the code to set this, I've tried:
flyTree.Height = Unit.Pixel(pixels);

flyTree.FocusNode = companynode;
companynode.Expand();
companynode.Selected = true;

Neither setting FocusNode nor setting the node's Selected attribute seem to work.
The node does look like it selected because it is the only node that is expanded...it's just that if this company is not at the top of the company node list, it won't show up until the user scrolls down :-P

Looks like I might be able to set the flyTree.ScrollTop but is there a way to have the flyTree set this automatically based on the selected node?
Link Posted: 03-May-2011 11:02
Did you managed to find a way to scroll to the selected node?
Link Posted: 03-May-2011 11:09
Actually, the FocusNode property should work. If it doesn't, it could be a bug.
Does it fail to focus in an alternative browser?
Link Posted: 03-May-2011 11:38
Are we talking about ClientSide? Because it's there where I add it. CFlyTreeView doesn't have focusNode or FocusNode property. I'm using 4.3.2 version.
Link Posted: 03-May-2011 11:55
There is a server-side FocusNode property.

As for client-side, you can try to use the following code
node.getElement().scrollIntoView();

You can find node if required by CFlyTreeView.findByID or findByValue or generic find(func).
Link Posted: 03-May-2011 12:23
Kudos to you Evgeny!
I confirm that 'node.getElement().scrollIntoView()' is working in all major browsers.
Thank you!