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

PivotGrid with complex types.

5 Answers 135 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
tristan Brenner
Top achievements
Rank 1
tristan Brenner asked on 15 Sep 2013, 08:06 AM
Hi,
We are using PivotGrid with localdatasourceProvider connected to an Entity Framework DbContext.
We are using a navigation property to group the datas.
Pivotgrid display the name of our object returned by  .toString().
We would like to display one property of this object for our datatemplate.

What is the best solution ?

Thanks for all, Tristan

5 Answers, 1 is accepted

Sort by
0
tristan Brenner
Top achievements
Rank 1
answered on 16 Sep 2013, 10:51 AM
Hi,
I still not achieve to display my related data : I tried to use the row header datatemplateselector.
But I can't get my object in Parameters Items or Containers.

Thanks for your ideas
0
Rosen Vladimirov
Telerik team
answered on 18 Sep 2013, 12:29 PM
Hi Tristan,

From your other thread I assume your problem is only with the name shown in RadPivotGrid - the data is fine, am I correct? If this is the case there are several ways to change the name in the UI. First one is to use DataAnnotations and set a name for the property in the generated from Entity Framework code:
[Display (Name="Test")]
public virtual ICollection<Customer> Customers { get; set; }

You can find more information about DataAnnotations in our online help.
The other option is to set CustomName property of the PropertyGroupDescription:
<pivot:PropertyGroupDescription PropertyName="Customers" CustomName="Test" />

Feel free to contact us in case you have any problems or concerns or I have misunderstood your problem.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
tristan Brenner
Top achievements
Rank 1
answered on 18 Sep 2013, 01:54 PM
Thank you Rosen,
Our model is two tables : Customers and Orders.
In the class Order we have the property 'CustomerId' and the NavigationProperty 'Customer'.
 In the class Customer we have the properties 'Name' and 'Id'.
We would like to use the link Order.Customer .

We do not want to change the name of the table, We would like to acceed to the property 'Name' in the pivotgrid in the groupdescription even if the datas came from the table Orders.

I hope it is more clear.

Tristan
0
Accepted
Rosen Vladimirov
Telerik team
answered on 19 Sep 2013, 11:18 AM
Hi Tristan,

In order to achieve this you will have to flatten your data in the application. That is the only way to use the data from Orders table in RadPivotGrid - you have to create an object for each order of a customer (I assumed the relation between Customers and Orders is 1:M).

I've prepared a sample project to demonstrate this approach. Could you check it and inform us in case you have any problems or concerns?

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
tristan Brenner
Top achievements
Rank 1
answered on 20 Sep 2013, 09:03 AM
Hi Rosen,
Thank you for this solution. We built a new class with the properties linked to the fields of our differents tables and that's ok !
Thanks for all
Bye, Tristan
Tags
PivotGrid
Asked by
tristan Brenner
Top achievements
Rank 1
Answers by
tristan Brenner
Top achievements
Rank 1
Rosen Vladimirov
Telerik team
Share this question
or