This is a migrated thread and some comments may be shown as answers.

Extended grouping

1 Answer 91 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 18 Mar 2013, 01:47 PM
Hi!

I need some support to create a treeview, that is bound to a dataset and hierarchically displays the content in the following way:

Customer 1

     Orders (<- Group node)

         Order 1

     Shipping Notes (<- Group node)

         Shipping Note 1

         Shipping Note 2

     Invoices (<- Group node)

         Invoice 1

     Order 2

     Order 3


In the underlying relational structure are the four datatables "customer", "orders", "shipping notes" and "invoices" with parent-child relationships between "customer" - "orders", "orders" - "shipping notes" and "orders" - "invoices". The dataset structure corresponds to the database structure, so I'm not able to change it.

I tried to extend the basic grouping example from Valentin Stoychev using a CollectionViewSource, but i was not able to combine them.

Can you give me a hint how get it to work?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 21 Mar 2013, 09:34 AM
Hello David,

 As I managed to understand, the Orders Entity can have different kinds of children -orders, shipping notes, invoices. Or you have to combine both grouping of items in a parent item and having children from different types. In both cases I highly recommend you to use ViewModel wrapper classes to your DB data. Build a ViewModel hierarchy to reflect the way you need to display a hierarchical data in the RadTreeView. With a proper ViewModels  the grouping comes out of the box - you can create a suitable ViewModel to display group of child items. As for the problem with different kinds of children - just make sure that the child ViewModels implement a common Interface or extend a common  class. Attached is a sample solution demonstrating an approach with different kinds of children - file/folder hierarchy (a folder can have both child folders and child files). Hope you will find it useful.

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeView
Asked by
David
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or