Update pivot table when source is updated

Hello, 

I am trying to update a pivot table when the source data item changes. I have this working with an Observable Collection as described here: https://www.syncfusion.com/faq/blazor/data-binding/how-do-you-show-real-time-data-updates-using-observablecollection. However is this possible to do with just a list as the source data binding indstead of using an Observable collection and the INotifyPropertyChanged structure?


Thank you,


1 Reply

AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team August 22, 2022 12:32 PM UTC

Hi Leland,


Yes, you can update the pivot table by dynamically changing the list type data source. Please refer to the code example below.


Code-example:

<SfButton OnClick="@OnChangeData">Change Data</SfButton>

 

public async Task OnChangeData(MouseEventArgs args)

    {

        await Task.Delay(1000);

        if (_productDataType == 0)

            PivotData = ProductDetails.GetProductData();

        else if (_productDataType == 1)

            PivotData = ProductDetails.GetProductData2();

 

        if (_productDataType >= 1)

            _productDataType = 0;

        else

            _productDataType++;

   }


Meanwhile, we have prepared a sample for your reference below.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PivotTable-1021104143


Please let us know if you have any concerns.


Regards,

Angelin Faith Sheeba.


Loader.
Up arrow icon