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

Is it possible to bind dynamic object to PivotGrid

5 Answers 230 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Vadimir
Top achievements
Rank 1
Vadimir asked on 25 Oct 2013, 10:07 AM
Hi
I’m working on a project to create pivot table dynamically.

The goal is to build a pivot table based on 2 Collections, which is generated by reading some file. The 1st collection defines the column names and type (e.g. double, string, etc.) of the data. The 2nd one contains a list of strings, which represents all the data, so the type of the data is only known at run time.

I'd like to know is it possible to bind the above data structure to the RadPivotGrid. 

I've tried to set a Collection of dynamic objects to the ItemsSource by using LocalDataSourceProvider, but it seems the data are not shown in the pivot table.

An example of the dynamic object.
dynamic dObject1 = new ExpandoObject();
dObject1.Name = "Name1";
dObject1.Value = 1;

Thanks in advance.

Regards,
Gong

5 Answers, 1 is accepted

Sort by
0
Accepted
Rosen Vladimirov
Telerik team
answered on 28 Oct 2013, 07:51 AM
Hello Gong,

Thank you for contacting us. Currently it is not possible to use ExpandoObject as a source for RadPivotGrid. You can use ICustomTypeProvider instead. Another option is to convert your ExpandoObject to DataTable at runtime as shown in this thread.

Hopefully this helps. Feel free to contact 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
Vadimir
Top achievements
Rank 1
answered on 28 Oct 2013, 10:43 AM
Hi Rosen,

Thanks. I'll go for the DataTable solution. It would be nice to have a DataTable binding example in the document. I didn't know that it is possible.

Regards,
Gong
0
Accepted
Rosen Vladimirov
Telerik team
answered on 28 Oct 2013, 10:53 AM
Hi Gong,

In this article is mentioned that you can use DataTable as ItemsSource of LocalDataSourceProvider, but we'll consider adding a full example.

Feel free to contact us in case you face any problems with the usage of RadPivotGrid with DataTable.

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
Ql
Top achievements
Rank 1
answered on 18 Dec 2013, 04:11 AM
Hi Rosen ,
Where can i download the full sample of using DataTable as ItemsSource of LocalDataSourceProvider? Could you provider the link?
0
Kalin
Telerik team
answered on 20 Dec 2013, 09:14 AM
Hello Ql,

We have prepared a small sample example which demonstrates the exact approach on using DataTable as ItemsSource of the LocalDataSourceProvider. Please check the attachment.

Hope this helps.

Regards,
Kalin
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 >>
Tags
PivotGrid
Asked by
Vadimir
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Vadimir
Top achievements
Rank 1
Ql
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or