Displaying Child Object Attributes in same row as parent object

Apr 10, 2009 at 3:17 AM
Thanks to Colin,  I've had great luck in using heirarchical business entites with the DataGrid using the RowDetail functionality.

I have a frustrating requirement from my stakeholders.   Using a grid, I need to display 4 levels of heirarchical business entities in 3 levels. 

A simple example would be like this (using 3 levels)
Customer has a collection of orders
Each Order has a collection of Order Details.
OrderDetails has a sum total attribute

I need to display it in a data grid like this:

ROW:   Customer.attribute1 | Customer.attribute2 |
ROW:   Customer.attribute1 | Customer.attribute2 |
    RowLevelDetails: Order.attribute1 |Order.attribute1 | Orderdetail[0].SumTotal  | Orderdetail[1].SumTotal  | Orderdetail[2].SumTotal  | 
    RowLevelDetails: Order.attribute1 |Order.attribute1 | Orderdetail[0].SumTotal  | Orderdetail[1].SumTotal  | Orderdetail[2].SumTotal  | 
    RowLevelDetails: Order.attribute1 |Order.attribute1 | Orderdetail[0].SumTotal  | Orderdetail[1].SumTotal  | Orderdetail[2].SumTotal  | 

The RowlevelDetails are sort-of a mashup.  I do know that there are a fixed number of OrderDetails so it is not variable.


Is there a way to do this without "muddying" my business entities with extra attributes (e.g. I don't want to add three SumTotal attributes to the Order entity).

Regards,
Tracy



Apr 14, 2009 at 7:33 PM
Edited Apr 14, 2009 at 7:33 PM
I was able to write a vaue convetor that provided me display...but I couldn't translate from the cell back to the child attribute... I was passing in the entire OrderDetails collection to the value convertor and returning the value of Orderdetail[x].SumTotal.  I provide a convertor parameter that tells which orderDetails object to pull the value from  (e.g. what is "x").

Does anyone have any recommendations for how I can accomplish this? (Custom bindings? Value convertors? Bind to a Function or Method?)

Any help is welcome...
Tracy