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

Dynamically Loading Data

3 Answers 48 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Justin Hunter
Top achievements
Rank 1
Justin Hunter asked on 05 Sep 2013, 03:41 PM
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

3 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 05 Sep 2013, 03:56 PM
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 >>
0
Justin Hunter
Top achievements
Rank 1
answered on 05 Sep 2013, 04:08 PM
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.
0
Rosen Vladimirov
Telerik team
answered on 10 Sep 2013, 02:46 PM
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 >>
Tags
PivotGrid
Asked by
Justin Hunter
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Justin Hunter
Top achievements
Rank 1
Share this question
or