|
Rank: Member Groups: Member
Joined: 8/19/2011 Posts: 15
|
I have a Treeview in a Multipage PageView, this resides in a splitter all is fine, until you scroll down the tree view a little, then either close the splitter and re-open it, treeview scrolls back to top, also this happens when you switch Tabs, is there a way that I can keep the selected node of the tree in focus when I either select the tab or re-open the splitter pane.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That would really depends on what you mean by "close the splitter and re-open it" or "switch tabs" and what your code did when that happens. If everything happens on the client side, then you do not need do anything to keep the selected node. If those triggers server events and you rebuild your TreeView on each request (for example, rebuild the TreeView from data source in your Page_Load), then you certainly would lose all the status information, including the selected node. If each tab loads a separate page (even though they all use the same master page), then the TreeView will lose its status information too because you are switching pages.
The best way to resolve your problem is to create a single test page and see it working first. The default setting should work fine (keeping both scroll position and selected node) for you. Once you get a test page working, compare your test page with your real page and you should be able to understand what will make it work and what will break it.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 8/19/2011 Posts: 15
|
Thanks for quick reply, I found the best way to keep the position in view, was to add the extra bit of Javascript to the OnSplitterResized function code is:
var tNode = treeView.getSelectedNode(); if (tNode != null) tNode.ensureVisible();
This works fine, when switching the Tabs (TreeView, Search), also works when the splitter is closed fully and then re-opened with the >> arrows on the splitter.
Thanks again, starting to get the hang of these controls.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Thanks for sharing! Glad to hear that it works for you.
|
|