BackgroundI am trying to display two tables in an UltraTree control: Location and Machine. The Location table is the hierarchy; the Machine table references the Location table.The tables have the following columns (the relevant ones):Location--------LocationPKNameParentLocationPKMachine-------MachineIDNameLocationPK(lots of other columns)Each node in the tree will have one of two types of children - any number of locations *or* exactly 1 machine.I want the tree to display the Location heirarchy using just the name column, and if they expand a name and it is referenced by a machine, show the machine details (quite a few columns of information).
ProblemCurrently whenever a Location node is expanded, it shows two child nodes - "Location" and "Machine". The user then has to expand the "Location" and "Machine" columns to see the next layer of details.Is there a way to hide the "Location" and "Machine" nodes from appearing, and instead show their children, when only one of those bands has children?
Edited to add: From the documentation on the UltraTreeColumnSettings.ShowBandNodes, it says: "Regardless of the setting of ShowBandNode, band nodes will always be created to separate siblling bands. In a case where a child band has no siblings, a band node will be created for it if ShowBandNodes is set to ShowBandNodes.Always"
Is there a way to hide a band from appearing when there are no child nodes for that band?
ExampleI am seeing this:- RootLocation - Location - ThisIsALocationName - AndAnother - Location - YetAnotherLocation - Location - Machine - AMachine | All | Columns | Appear | Here... - Machine - Machinebut want to see this instead:- RootLocation - ThisIsALocationName - AndAnother - YetAnotherLocation - AMachine | All | Columns | Appear | Here...Further DetailsI have created a DataSet and populated it with two tables, Location and Machine. I have added two relationships to the DataSet like so:
dataSet.Relations.Add("Location", rv.Tables["Location"].Columns["LocationPK"], rv.Tables["Location"].Columns["ParentLocationPK"], false);
dataSet.Relations.Add("Machine", rv.Tables["Location"].Columns["LocationPK"], rv.Tables["MachineColumns["LocationPK"], false);
I have looked through the examples in the WinTree folder in the Samples directory. I have not been able to find an example that uses two tables in one tree via a bound DataSet.
We have also considered styling the screen after the sample in folder "DataBinding (Navigation) CS"; however we'd like to see if this specific problem can be overcome as we will most likely encounter this situation again in the future.
Jay said:Why is there not an option to hide the relationship band nodes in the UltraTree. I'm not sure why anyone would want to see these empty band nodes that map one row to another.
The band nodes exist to separate child bands. Orignally, the WinTree didn't support data binding. Binding support was added later and so the data has to be displayed using the existing node structure that the tree already supports.
If you combined two sibling bands into a single island of data, the user would have no way of knowing that they were two separate islands of data, and the tree would have no way to expose two separate collections of child nodes from a single parent node.
Mike,
Thanks that was the clarification I needed. I missed the fact that there was only one child per band and that is why this worked. I was trying to remove the band nodes completely. I was able to achieve this with the UltraGrid instead although it took me some time to find out that I had to set the MaxDepth because it kept locking up.
Just curious....Why is there not an option to hide the relationship band nodes in the UltraTree. I'm not sure why anyone would want to see these empty band nodes that map one row to another.
Hi Jay,
I'm not following you. The original issue here had to do with the fact that the data source contains sibling bands. That is... a parent band with two child bands that are sibling to each other. And the idea was to remove one of the child bands so that only one child band exists and therefore the tree does not need to display the "Band Nodes" that separate the sibling child bands.
Jay said:I am not seeing in the provided code how to reassociate the child table directly to the node without the relationship node.
So this is where you lost me. There is no need to re-associate anything. It sounds to me like maybe you are trying to show both child bands in one list without the band nodes. That is not possible.
Sorry about digging up an old thread. I'm having a similar issue. I have tried to implement with the code provided but it isn't working the same.
I have my copy of the columnSet in a field variable where i have removed the "child" column that has the nested table.
I then perform the node.Override.Columnset set using this columnSet that does not contain the "child" column any more. The end result is a row without any children which is what I would expect since I did remove the "child" column when I created the columnSet clone.
I am not seeing in the provided code how to reassociate the child table directly to the node without the relationship node. Am I missing something? Maybe I am associating the ColumnSet with the wrong node somehow? Looking at the supplied code it looks like you associate the ColumnSet with the parent node which is what I am doing.
Basic recap:
ColumnSetGenerated event:
AfterDataNodesCollectionPopulated Event:
Thanks for this. It works.
Cheers,
Assad