I have a DataSet with 6 relations which got presented in a tree. In some cases the first relation and its childrelation does not contain any data, so the tree only shows the relation-node for this two relations. Then the user start a process which inserts data for those two relations in the database, and then the tree gets refreshed by getting the data from the database and binding it to the tree.
But in this special situation, the tree does only load the rows of the first relation. It does not display a node for the child-relation of the first relation.
Hi,
Okay, I see the issue. The tree in your sample is set up to AutoGenerateColumnSets. Unlike the grid, the tree does not assume that those ColumnSets are no longer valid when you rebind. The tree keeps the ColumnSets and the data structure separate to allow greater flexibility in setting up your columns.
So what's happening here is when you expand the tree the first time and ColumnSet is generated using the Key of the band and containing only the columns of the initial data structure.
When you rebind the tree, a ColumnSet already exists which matches the key of the child band, so the tree re-uses this ColumnSet. But of course, this ColumnSet does not account for the new data structure since it was created for the old one.
So to get around this, all you have to do is remove that ColumnSet from the tree before you rebind. This will force the tree to create new ColumnSets for the new data structure.
this.ultraTree1.ColumnSettings.ColumnSets.Clear(); this.ultraTree1.SetDataBinding(set, "basis");
The sample project is now attached.
When replying to your post, just go to the Options tab and you can attach a zip file with your sample project.
The attached sample does demonstrate the behaviour. At the start of the demo application the tree does display the empty first relation node. And then when the user click on the Menubar "Test" --> "Reload" a new datasource is bound to the tree, and the tree does not show the second level of the first relation correctly!
In the bottom of the form is a grid, which shows the same datasource correctly.
The behaviour of the tree does only occure when the nodes was expanded before.
Regards