I have a self referencing dataset that is used to create a tree structure. The dataset has 2 tables 1 for projects (self referencing) and the other for tasks. The task table has a foreign key to the projects table.I have bound this to the UltraWinTree and it does correctly show the tree structure. However, it currently adds in a node that represents the band as follows:--My Root level project -c03_GetAllProjects_c03_GetAllProjects --> (table 1) -My sub-project -c03_GetAllProjects_c03_GetAllProjects -c03_GetAllProjects_c03_GetAlllnkProjectTask_Min -Task1 -c03_GetAllProjects_c03_GetAlllnkProjectTask_Min --> (table 2) -Task1 -Task2 -Task3 The issue with this is that I don't want a node to be displayed for each band this is unnecessary. I want it to look more like the following:--My Root level project -My sub-project -Task1 -Task1 -Task2 -Task3 How can I do this? If this is not possible how do I change the text of these additional nodes?
Hi,
There's no way to do this. The Band node has to be there to separate the child nodes from the two different child bands. Otherwise, nodes from two different tables would end up in the same Nodes collection.
Thanks for the response. However, I do believe that this is an issue. You should be able to hide these unnecessary nodes levels. As is, this does not allow full control over the tree structure.I will submit a feature request for this. As I have to put up with these nodes, where do I set the node text?
I think the easiest place to do that would be the InitializeDataNode event. There's a property on the node for IsBandNode, so you can tell if it's one of the band nodes.
Hi Mike, Sorry to hassle you with this but with the following code I get error 'Item has already been added. Key in dictionary: 'Projects' Key being added: 'Projects''. Any ideas?
Private Sub UTAllProjects_InitializeDataNode(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.InitializeDataNodeEventArgs) Handles UTAllProjects.InitializeDataNode Me.UTAllProjects.BeginUpdate() Me.UTAllProjects.SuspendLayout() If e.Node.IsBandNode Then If e.Node.BandName.Contains("c03_GetAllProjects") Then e.Node.Text = "Projects" ElseIf e.Node.BandName.Contains("c03_GetAlllnkProjectTask_Min") Then e.Node.Text = "Tasks" End If End If Me.UTAllProjects.ResumeLayout() Me.UTAllProjects.EndUpdate() End Sub
Updated controls to version 9.1.20091.2050 - Issue appears to be sorted now!
Thanks for taking the time to look into this Mike!No, what you have described I would expect. I know that I'm setting the text the same for the different band types. It was simply the case that this example caused the error. On my version I get 4 sub-nodes when I would expect only 2. Expanding another node would generate the error. I'm using v9.1.20091.2012 of the UltraWinTree control. This issue definitely does occur with this version. Which version are you using?With regards to the performance issue, I digress, this is simply another issue I encountered. I will try your suggestion to use ColumnSetGenerated.
aim123 said:The error occurs when you expand nodes. On the first expansion you see duplicates, on the second expansion you get the error. It doesn't matter which node, just choose any root node.
Okay, I tried your sample again. When I expand the first node, I see two band nodes with the same text. But there's nothing incorrect about that. These are the two band nodes, and your code is assigning the same text to both of them. In fact, your code is assigning the same text to every band node in the tree.
Is that what you mean by duplicates?
I tried expanding other nodes, but I don't get any exceptions. In fact, I even tried pressing the "*" key which expands all nodes and it works just fine for me.
I am, of course, testing with the latest service release. Perhaps you are using an older version and that was related to a bug that is already fixed.
How to get the latest service release - Infragistics Community
aim123 said: With regards to hiding nodes etc. in the InitialiseDataNode function I find this to be very, very slow. e.g I wanted to hide some colums for all but the root and leaf level nodes so I placed the following code in the initializeDataNode event.. If e.Node.Parent Is Nothing Or e.Node.Nodes.Count = 0 Then e.Node.Cells("ExpectedDuration_Hours").Column.Visible = True e.Node.Cells("ExpectedDuration_Mins").Column.Visible = True Else e.Node.Cells("ExpectedDuration_Hours").Column.Visible = False e.Node.Cells("ExpectedDuration_Mins").Column.Visible = False End If This is simple yet takes 2 or 3 minutes to complete with the same dataset used in the test app! I have used 'BeginUpdate' and 'SuspendLayout' but this makes no difference to performance.
With regards to hiding nodes etc. in the InitialiseDataNode function I find this to be very, very slow. e.g I wanted to hide some colums for all but the root and leaf level nodes so I placed the following code in the initializeDataNode event..
If e.Node.Parent Is Nothing Or e.Node.Nodes.Count = 0 Then e.Node.Cells("ExpectedDuration_Hours").Column.Visible = True e.Node.Cells("ExpectedDuration_Mins").Column.Visible = True Else e.Node.Cells("ExpectedDuration_Hours").Column.Visible = False e.Node.Cells("ExpectedDuration_Mins").Column.Visible = False End If
This is simple yet takes 2 or 3 minutes to complete with the same dataset used in the test app!
I have used 'BeginUpdate' and 'SuspendLayout' but this makes no difference to performance.
Okay, now one of us is confused. Hiding a Column inside the InitializeDataNode event makes no sense. This event fires for each node loaded from the data source. If you want to hide a column, the ColumnSetGenerated event would be a much more efficient place to do this.
I thought we were talking about hiding nodes, not columns.
The error occurs when you expand nodes. On the first expansion you see duplicates, on the second expansion you get the error. It doesn't matter which node, just choose any root node.
What do I have to do to get the error? I ran your sample half a dozen times with no exceptions.
aim123 said:Surely the control decides which rows will be root by the presence of null for the parent column as defined in the data table's relation.
The control displays the data you give it to display. If the root-level band of your data set is a table that contain all the rows, then all the rows will show up in the tree.
So you can use InitializeDataNode to hide the root-level nodes that have parent IDs.
Or, you could set up your data source with 2 tables. The root-level table would be a query that only returns the parent rows and then that table would have a Relationship to the child table (which contains all the rows) which then has a relationship back to itself.