Hey there
I have two questions that relate to minor functionalty/formatting of the WebTree, I'm sorry if they have very obvious answers, but I've looked at several of the examples on the example page that behave the way I want and I just can't see how it's done.
1) When a user expands a root node, I would like that node to be selected2) How do I get leaf nodes that are on the same level as root nodes to have the same indentation? Currently my leaf nodes are indented as much as the next level root nodes are.
Any help would be greatly appreciated
Thanks
Hello,
1. This could be possible using the UltraWebTree client-side object model. You can hook the NodeExpand client-side event documented here
http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/WebTree_Client_Side_Events_CSOM.html
and then call setSelected for the node passed to the eventArgs of the event, documented here:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/WebTree_Node_Object_CSOM.html
2. I am not sure about the specifics of your scenario, but generally paddings and margins can be adjusted using
<ignav:Node Text="Child Node"> <Margin Left="20" /> <Padding Left="20" /> </ignav:Node>
HTH,
Thanks for the help Rumen, that first solution worked perfectly for me!
About the 2nd one though, my tree is being auto generated by a WebHierarchicalDataSource, so I don't specify the nodes individually. However I do have access to them through the NodeBound event, where I do some other work with each node, and in there every node has a left padding and left margin of 0 pixels.
Any suggestions?
Thanks again
I found a solution for my indentation issues, posting it in case it helps anyone else.
In the code behind I just set individual leaf nodes margin and padding to a negative pixel number, that backed them up so they were inline with the root nodes.
Thanks for the help
That's a good idea - thanks for sharing. As far as I get it - in the NodeBound event you get each individual node, check if it is leaf node (node.Nodes.Count = 0) and if this is thecase, you can set Margin or Padding (or both) to negative pixels so that it is shifted left and appears as if it is in line with the parent node.This definitely sounds like a good idea.
That is the general idea, but there is one caveat with that method that I actually ran into.
When you access a node in the NodeBound event, it is brand new in the tree, and thus it will never have children because they haven't been bound yet.
Luckily we had a leftover column in our database to designate which nodes are leaf nodes, so I just checked that in the datarow for the node. :-)
But the general principal still stands, if you can somehow determine which nodes are leaf nodes you can set those nodes individually to have negative pixel paddings/margins and it will move them backwards in the tree.