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

PivotGrid dynamic Ressources

5 Answers 109 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Julien
Top achievements
Rank 1
Julien asked on 22 Feb 2013, 03:05 PM
Hi, 

i actually test the PivotGrid with this http://www.telerik.com/help/silverlight/radpivotgrid-getting-started.html
+ a pivotFieldList

But its Static Ressources on Xaml.

<UserControl.Resources>
<pivot:LocalDataSourceProvider x:Key="LocalDataProvider" AggregatesPosition="Rows">
            <pivot:LocalDataSourceProvider.RowGroupDescriptions>
                <pivot:PropertyGroupDescription PropertyName="Name" />
            </pivot:LocalDataSourceProvider.RowGroupDescriptions>
            <pivot:LocalDataSourceProvider.ColumnGroupDescriptions>
                <pivot:DateTimeGroupDescription PropertyName="Date" Step="Month" />
     ...
This code is Static for only one class : "product'

How to do same but dynamic, like a classique Datagrid where we can fill it with auto generates columns
like datagrid1.itemsource = e.Result; // im using web services to get SQL data

Thanks for help in advance.

5 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 22 Feb 2013, 03:47 PM
Hi Julien,

If you want to use dynamic data, RadPivotGrid supports ICustomTypeProvider. You can check attached an implementation of such scenario. More information about ICustomTypeProvider is available in msdn. Also you can check our online help for more information how to set LocalDataSourceProvider in code.

Just one note - you cannot set the group descriptions automatically, you will have to define them in your code or use RadPivotFieldList.

Hopefully this helps.

Greetings,
Rosen Vladimirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Julien
Top achievements
Rank 1
answered on 25 Feb 2013, 07:48 AM
Thanks a lot. i saw your example.

im using both RadPivotFieldList and RadPivotGrid.

So, you said i need to : "define them in your code or use RadPivotFieldList."

Then i should use define statics group descriptions for the RadPivotFieldList? or i can make it dynamic?
or best way is to make one RadPivotGrid by SQL table and define group descriptions ?

0
Rosen Vladimirov
Telerik team
answered on 25 Feb 2013, 01:22 PM
Hi Julien,

Let me explain the connection between RadPivotGrid and RadPivotFieldList. In your code you should create a DataProvider and use it for both of the controls. If you use different providers, than all changes in RadPivotFieldList will not apply on RadPivotGrid. When you define group/aggregate descriptions, you define them on the DataProvider, not for RadPivotGrid or RadPivotFieldList. Both controls will visualize what you've defined, but in a different way. When you use LocalDataSourceProvider, the top part of RadPivotFieldList will show all public properties of the objects you have used as ItemsSource. But in your case you may not know what are the properties that must be shown there. And here is the usage of ICustomTypeProvider. By using it you can add properties at runtime. Also you can define such properties as your group/aggregate descriptions. This way you can define group description at design time for a property which will be created at runtime. To create group descriptions at runtime, you can use RadPivotFieldList (group description is created for each item placed in one of the bottom boxes of the FieldList - Rows, Columns, Filters, Values).

I'm not sure I fully understand this sentence: "or best way is to make one RadPivotGrid by SQL table and define group descriptions", but you can use the data from an SQL statement for ItemsSource of your DataProvider and set group descriptions for it.

Do not hesitate to contact us if you still have any problems or concerns. You may also take a look at our online help and particularly the "Understanding RadPivotGrid" article.

Kind regards,
Rosen Vladimirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Julien
Top achievements
Rank 1
answered on 26 Feb 2013, 07:54 AM
Yes, sorry for my english :s.

I mean : 
if i have multiple tables like :
- Client(name, age, adress etc)
- Stock emplacement (emplacement, reference, quantity..)
- Orders ( Expedition type ...)

my test running i got all my orders in Radpivotgrid, 

So i just need now:
- hide or allow some columns, then i can show only columns i want.(or i should do it to my entity framework querys)?

0
Rosen Vladimirov
Telerik team
answered on 27 Feb 2013, 10:21 AM
Hi Julien,

If you want to remove particular items in one of the group descriptions, you should edit your query, but if you want to hide whole group, just remove the group description.

Hopefully the above makes sense for your case.

Regards,
Rosen Vladimirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
PivotGrid
Asked by
Julien
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Julien
Top achievements
Rank 1
Share this question
or