0

Scroll a tree to display the opened node on top of the container

asked 2016-11-07 11:33:35 +0800

WilliamB gravatar image WilliamB
1609 1 6

Hey there,

Using ZK6, I've a tree inside a container (Center object from borderlayout) and when I click on a node to open it and displays its children, I want the node to be scrolled up to the top of the container.

Even if the node is already visible, if there is a scroll I want it to be the first node (if enough scroll available) visible in the container.

Is there a JS I can call on the onOpen event to do that? Tried Clients.scrollIntoView but doesn't help.

Thanks

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-11-07 14:45:17 +0800

WilliamB gravatar image WilliamB
1609 1 6

This might help others

String idContainer = controler.getCenter().getUuid() + "-cave";
String idTreeRow = item.getTreerow().getUuid();

item.setWidgetListener(Events.ON_OPEN, "var myContainer = jq('#" + idContainer + "'); var scrollTo = jq('#" + idTreeRow + "'); "
    + "myContainer.animate({scrollTop: scrollTo.offset().top - myContainer.offset().top + myContainer.scrollTop()});");
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2016-11-07 11:33:35 +0800

Seen: 24 times

Last updated: Nov 07 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More