Dynamically Loading Data

4 posts, 0 answers
  1. Justin Hunter
    Justin Hunter avatar
    9 posts
    Member since:
    Jul 2010

    Posted 05 Sep 2013 Link to this post

    I just found out about this wonderful PivotGrid but there is something I am concerned with. My dataset will be in the millions - while I'm not concerned with the time it takes to render, I was concerned about the memory the 5,000,000 example took. I understand that the PivotGrid sorts and aggregates an existing dataset, so I turned my attention to the PivotFieldList.

    I want to limit the data that gets brought back, so I was hoping I'd be able to use the filtering options to create a specific where clause so I only get the data I want. This would be done by pointing the PivotFieldList to a different DataProvider that is simply there to give it mocked data, so it will always know of every choice. Then I'm hoping there could be some kind of event that I could capture that would assist me in digging into the internals and building a where clause that the actual PivotGrid's DataProvider would then apply.

    Thanks
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 05 Sep 2013 Link to this post

    Hello Justin,

    You can use StatusChanged event of LocalDataSourceProvider and check if the status is Ready. When it is ready you can use Dispatcher (statusChanged event is not on the UI thread) to execute your logic.

    Hopefully this helps.

    Regards,
    Rosen Vladimirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    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 >>
  3. DevCraft banner
  4. Justin Hunter
    Justin Hunter avatar
    9 posts
    Member since:
    Jul 2010

    Posted 05 Sep 2013 Link to this post

    I am having an issue determining how I'd build a where clause with the data given back to me. :/ This is just completely foreign to me, sorry.
  5. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 10 Sep 2013 Link to this post

    Hi Justin,

    I'm not sure I fully understand your case. In Silverlight there isn't DataSet class, am I missing something? If your data is in database, how do you access it? Let me explain my understanding:
     - RadPivotGrid will use one DataProvider (lets call it PivotDataProvider). It will not be changed directly from the user.
     - RadPivotFieldList will use another DataProvider (called FieldListDataProvider). The user will change the settings of this provider.
    So when FieldListDataProvider is changed (user adds or removes group/aggregate descriptions), you want to take from database only the data for the selected descriptions. But how to take only this data depends on the way you access the DB.

    In order to cover the above scenario you can use the following setup. Let's say your data is of type Order (it has Product, Promotion, Net, Quantity members). In order to see these properties in RadPivotFieldList, you have to give ItemsSource to FieldListDataProvider. You can create a fake collection, just to populate RadPivotFieldList with data:
    List<Order> fakeCollection = new List<Order>();
    (this.Resources["PivotFieldListProvider"] as LocalDataSourceProvider).ItemsSource = fakeCollection;

    After that you have to handle SelectionChanged event of FieldListDataProvider and call a method that gets the data from DB and set it as ItemsSource of RadPivotGrid. Also you have to set all GroupDescriptions, FilterDescriptions, AggregateDescriptions that the user had set in RadPivotFieldList to PivotDataProvider:
    private void LocalDataSourceProvider_StatusChanged(object sender, Telerik.Pivot.Core.DataProviderStatusChangedEventArgs e)
    {
        var dataProvider = sender as LocalDataSourceProvider;
     
        if (e.Error != null && e.NewStatus == DataProviderStatus.Ready && !dataProvider.HasPendingChanges)
        {
            Dispatcher.BeginInvoke( () => this.FillPivot());
        }
    }

    Hopefully this helps.

    Regards,
    Rosen Vladimirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    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 >>
Back to Top