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

LocalDataSourceProvider Observable Collection Refresh

1 Answer 62 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
Benedikt asked on 28 Oct 2019, 03:25 PM

Hi guys,

 

I have a PivotGrid with a LocalDataSourceProvider.

The Itemsource of this LocalDataSourceProvider is a ObservableCollection.

I set these Descriptions:

            Telerik.Pivot.Core.PropertyGroupDescription pgdKWJahr = new Telerik.Pivot.Core.PropertyGroupDescription();
            pgdKWJahr.PropertyName = "KWJahr";
            pgdKWJahr.SortOrder = SortOrder.None;
            Telerik.Pivot.Core.PropertyGroupDescription pgdBearbeiter = new Telerik.Pivot.Core.PropertyGroupDescription();
            pgdBearbeiter.PropertyName = "Bearbeiter";
            PropertyAggregateDescription padAnzahl = new PropertyAggregateDescription();
            padAnzahl.PropertyName = "Anzahl";

            using (ldspAnzahlÜbergabeWerk.DeferRefresh())
            {
                ldspAnzahlÜbergabeWerk.RowGroupDescriptions.Add(pgdKWJahr);
                ldspAnzahlÜbergabeWerk.ColumnGroupDescriptions.Add(pgdBearbeiter);
                ldspAnzahlÜbergabeWerk.AggregateDescriptions.Add(padAnzahl);

            };

If the ObservableCollection now changes, I have to call a Refresh on the LocalDataProvider:

UcReklamationsAnzahlÜbergabeWerkVerlauf.ldspAnzahlÜbergabeWerk.Refresh();

 

This is not that great, but works if a value changes.The problem is, it not triggers anything if a new item should appear or an item is removed.

For better understanding:

My Collection is a list of how much things a user in each week completed. If someone now changes the weekrange, there should appear the new weeks in this range.

 

Is there any possibility to achieve this?

 

Greetings

Benedikt

1 Answer, 1 is accepted

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 31 Oct 2019, 11:16 AM

Hello Benedikt,

Thank you for the provided code snippet.

The LocalDataSourceProvider.ItemsSource property does not notify for collection changed. In order to refresh the ItemsSource of the LocalDataSourceProvider whenever the ObservableCollection changes you should first set it to null and then to the new value. Setting the ItemsSource to null will cause clearing the engine and then when the new ItemsSource is set the engine can reinitialize with the correct data. Currently, there is no other available way to cause re-initialization and recalculation of the data.

Regards,
Dinko
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PivotGrid
Asked by
Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or