PivotGrid dynamic Ressources

6 posts, 0 answers
  1. Julien
    Julien avatar
    3 posts
    Member since:
    Feb 2013

    Posted 22 Feb 2013 Link to this post

    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.
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 22 Feb 2013 Link to this post

    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.

  3. DevCraft banner
  4. Julien
    Julien avatar
    3 posts
    Member since:
    Feb 2013

    Posted 25 Feb 2013 Link to this post

    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 ?

  5. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 25 Feb 2013 Link to this post

    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.

  6. Julien
    Julien avatar
    3 posts
    Member since:
    Feb 2013

    Posted 26 Feb 2013 Link to this post

    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)?

  7. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 27 Feb 2013 Link to this post

    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.

Back to Top
DevCraft banner