Welcome Guest Search | Active Topics | Sign In | Register

TreeView, EnsureVisible(); Options
Amiran
Posted: Wednesday, January 14, 2009 7:36:53 AM
Rank: Member
Groups: Member

Joined: 11/21/2008
Posts: 15
Hi,

I have a TreeView in a WebPanel. The height of the WebPanel is 600px.
The treeview is populated with nodes of an XML document.
I tried to select a certain Node with the following code:

node.ExpandPath();
node.Selected = true;
node.EnsureVisible();

But it does not work. The treeview is expanded, the node is selected, but not visible if it is too deep in the treeview structure.
How do I ensure the node is visible (so that it is visible within the 600px webpanel)?

eo_support
Posted: Wednesday, January 14, 2009 7:41:24 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Please try the TreeView only in a separate blank page and see if that works. Sometimes the styles or other HTML in the page can affect the result. If that works, you can try to put your original page contents back piece by piece to see if you can locate the offending part. Also make sure you give the TreeView a fixed size.

Thanks!
Amiran
Posted: Thursday, January 15, 2009 12:26:54 AM
Rank: Member
Groups: Member

Joined: 11/21/2008
Posts: 15
eo_support wrote:
Hi,

Please try the TreeView only in a separate blank page and see if that works. Sometimes the styles or other HTML in the page can affect the result. If that works, you can try to put your original page contents back piece by piece to see if you can locate the offending part. Also make sure you give the TreeView a fixed size.

Thanks!


Hi,

I still have some problems with the function EnsureVisible(). Based on your advice I made the code mentioned below:

<eo:TreeView ID="TreeViewDocumentExplorer" runat="server" OnItemClick="TreeViewDocumentExplorer_ItemClick1"
AutoExpandOnClick="False" ClientSideOnContextMenu="ShowContextMenu"
OnItemPopulate="TreeViewDocumentExplorer_ItemPopulate" Width = "350px" Height = "450px">
<LookNodes>
<eo:TreeNode ItemID="_Default" SelectedStyle-CssClass="DocumentExplorerTreeNodeSelected">
</eo:TreeNode>
</LookNodes>
</eo:TreeView>

I read on the forum that

node.Selected = true;
node.EnsureVisible();

should make the node visible, but that doesn’t work.
EnsureVisible() is used, but I can’t see the node selected. TreeView is scrolling to the highest element in the tree.

eo_support
Posted: Thursday, January 15, 2009 5:24:17 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We are not aware of such problems. Please create a test page that demonstrates the problem and we will be happy to take a look (make sure the test page runs independently).

Thanks!
Amiran
Posted: Monday, January 19, 2009 6:09:37 AM
Rank: Member
Groups: Member

Joined: 11/21/2008
Posts: 15
eo_support wrote:
Hi,

We are not aware of such problems. Please create a test page that demonstrates the problem and we will be happy to take a look (make sure the test page runs independently).

Thanks!


Hi,

I stil have the TreeView problem.
I created a new project with only a treeview with 5 nodes on my page.
The treeview has a fixed height and width. In Default.aspx.cs the 5th node is selected en EnsureVisible() is executed:

protected void Page_Load(object sender, EventArgs e)
{
EO.Web.TreeNode tn = this.TreeView1.Nodes[4];
tn.Selected = true;
tn.EnsureVisible();
}

But again the node is not visible. My code can be found on the following location:

http://www.amiran.nl/TestTreeview_.zip

Regards,

Amiran
eo_support
Posted: Monday, January 19, 2009 8:39:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We have confirmed this to a bug with the current build and posted a new build with the fix. Please see your private message for the download location.

Thanks!
Alex
Posted: Thursday, October 14, 2010 12:47:33 AM
Rank: Member
Groups: Member

Joined: 9/1/2010
Posts: 20
Hello,

I have the same problem, can I urgently get the fix for this problem?
eo_support
Posted: Thursday, October 14, 2010 9:02:59 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

This problem has been fixed a long time ago and the fix is already in the current version. If you are having the same problem with the current version, then most likely it's a different problem. In that case please try to create a test page that demonstrates the problem and post it here. We will take a look as soon as we have that.

Thanks!
Alex
Posted: Friday, October 15, 2010 2:32:39 AM
Rank: Member
Groups: Member

Joined: 9/1/2010
Posts: 20
Hi,

You can find the test page here:
https://docs.google.com/leaf?id=0Bx8XBa5kqGszYzc2ZmJmNGMtMTlkMC00MGQ0LTkzNDktYjFjYzI4M2VhMDk5&hl=en&authkey=CPC158oJ
If you click the button, the page should select the "Recycle Bin" node, wich located at the bottom of the tree, which should be visible since I use ensurevisible. But it's not. Did I do it wrongly? Please help.
eo_support
Posted: Friday, October 15, 2010 7:45:02 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You don't need to do the loop. FindItem takes the full path. So the code should be something like this:

Code: Visual Basic.NET
TreeView1.FindItem(TextBox1.Text).Selected = True
TreeView1.SelectedNode.EnsureVisible()

Thanks
Alex
Posted: Friday, October 15, 2010 10:09:38 AM
Rank: Member
Groups: Member

Joined: 9/1/2010
Posts: 20
Hi,

I think I've solved my problem;
I omit TreeView1.ExpandAll() at the pageLoad then

in the button _click:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim paths() As String = TextBox1.Text.Split("/")
Dim mypath As String = ""
Dim i As Integer
For i = 0 To paths.Length() - 1
mypath = mypath + "/" + paths(i)
TreeView1.FindItem(mypath).Expanded = True
Next

TreeView1.FindItem(mypath).Expanded = True
TreeView1.FindItem(mypath).Selected = True
TreeView1.SelectedNode.EnsureVisible()
End Sub

I still use loop to expand the tree. I don't want it to expanded at all the nodes, I only want to expand it at the specific nodes. And if I use TreeView1.FindItem(textbox1.text).Expanded = True, it won't expand at all. Is this a bug?

eo_support
Posted: Friday, October 15, 2010 10:17:12 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

No. That is not a bug. A child tree node can be expanded while its parent node is collapsed. Consider if you first expand parent node A, then expand child node B, then collapse parent node A. At this moment the parent node A is collapsed but child node B is still expanded ---- even though now B is not visible. However if you expand A again, you will see B is still expanded.

You do need to use a loop to expand all the nodes. This function will do it for you:

http://doc.essentialobjects.com/library/1/eo.web.treenode.expandpath.aspx

Thanks
Alex
Posted: Friday, October 15, 2010 10:37:36 AM
Rank: Member
Groups: Member

Joined: 9/1/2010
Posts: 20
Thank you.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.