Here's what I would like to be able to do - hopefully the tree can do this for me but if not can someone give me some pointers about how I can achieve it another way?
I have a generic list of orders. They have a number of public properties, one of which is an "order type".What I would like to see in the UltraTree is the "order types" to be simple labels on the first level of the tree, allowing the user to open the appropriate ordertype "branch" to see the individual orders for that order type.
I appreciate I could create a dataset from the generic list at runtime and put two tables in there (ordertypes and orders) with a relationship between them - but I wondered if there is some way to configure the UltraTree to essentially 'group' the orders by ordertype and create the hierarchy automatically. Perhaps I'm asking too much!
I should also point out that I intend to use the UltraTree because different ordertypes need to have different column headings so I was advised the tree was the way to go - but if there is a better way I'm all ears.
Can anyone help?
Thanks
Mark
Hi Mark,
You are kinda stuck between two peices of functionality here.
The WinGrid would make it a lot easier for you to group the data, because the WinGrid support OutlookGroupBy. So you could bind the WinGrid to a single BindingList and then group by the OrderType column.
However, the grid can only bind to homogenous data and the column headers on the child bands must all be the same. So that won't work.
The WinTree can have different sets of column header and bind to different object on each node. But it doesn't support OutlookGropBy.
So it seems to me that what you will need to do is somehow divide up your data into multiple lists.
What I would do is - don't bind the root level of the tree. Instead just manually add the root level nodes with a node for each OrderType. Then what you can do is bind the child Nodes collection of each of these parent nodes to a BindingList that contains the items of that type.
Thanks for your help - I am now doing as you suggest - creating root nodes in code and binding each one to a Generic List of orders.
My next question is how do I configure the different column layouts for each ordertype? I can't create the layout at design time because I don't know which columns to display and/or what to put in the column headers at that time.
I will have another method somewhere in the application to provide column widths, visibility and headers for a particular ordertype, so my plan was to:
1. Loop through each order type.2. Add the root node.3. Bind the children of the root node to the list of orders.4. Configure the columns for node - change the order, width, visibility, captions etc based on the ordertype
I have been trying to do this in various ways but can't get part 4 to work! I either end up with the same column layout for each order type or I end up with the column layout I want but with no data showing! Can you offer any help or sample code?
markbeeton said:I think the issue was that the sets of child nodes are essentially the same
Yes, that definately would make sense. :)
I did try that but the ColumnSetGenerated event was only getting fired once (even though I had two sets of child nodes in the tree). I think the issue was that the sets of child nodes are essentially the same - I just want different column names for them. As far as I can tell the tree was firing the ColumnSetGenerated event once when the first set of child nodes was created but was not firing any more for the second and subsequent sets of child nodes.
Anyway - doesn't matter now - I've got it to work! Could you possibly look at my other questions?
http://forums.infragistics.com/forums/p/8677/34070.aspx
Another option would be to just leave AutoGenerateColumnSets to true and then use the ColumnSetGenerated event to modify them however you like. :)
Ignore! - finally worked it out - I wasn't setting the Key of the column correctly when I was adding it to the columnset. D'oh.