Updating data source in pivot view

Hi support,
I am updating the underlying data source of a pivotview control.

Initially I have my dataSourceSettings like this
     
     this.data = this.getsomeJsonData();
     this.dataSourceSettings = {
        dataSource: this.data,
        expandAll: false,
        rows: [{ name: 'pol' },{ name: 'pod' }, { name: 'weightGroup' }],
        columns: [{ name: 'isoType' }],
        formatSettings: [],
        values: [{ name: 'weight', type: 'Count', caption:'Containers' }],
        filters: [],
        showSubTotals: false,
        showGrandTotals: true,
        conditionalFormatSettings: []
       };
      this.pivotGridObj.gridSettings.allowSelection = true;
      this.pivotGridObj.gridSettings.selectionSettings =
        { mode: 'Cell', cellSelectionMode: 'Flow', type: 'Multiple' }


In the App there are button , once clicked that modify the underlying data source

    this.data = this.processData(args.item.id);
    this.pivotGridObj.refresh();


This works ok, but is there any way not to create the pivotview again and again , since it it a rather flickering experience. ?
Only very few cells are changed at a time

best regards
Rainer


9 Replies

MM Manikandan Murugesan Syncfusion Team February 17, 2020 06:41 AM UTC

Hi Rainer, 

You can update the pivot table with a new data source by simply assigning data to the pivot table instance as shown in the following code snippet. 

Code Snippet: 
 
document.getElementById('refresh').onclick = () => { 
    this.pivotObj.dataSourceSettings.dataSource = Pivot_Data2; 
}; 
 


Please let us know if you need any further assistance on this. 

Thanks, 
Manikandan.  



RA Rainer February 17, 2020 08:54 AM UTC

Hi Manikandan,

this does not work in my solution.

I tried with an empty array :

  this.dataSourceSettings.dataSource = [];

still the old data is shown in the pivot;
best
Rainer


MM Manikandan Murugesan Syncfusion Team February 17, 2020 09:10 AM UTC

Hi Rainer, 
 
Thanks for the reply. 
 
As we mentioned in our previous update, you need to assign the new data source to the pivot table instance. 
 
Code Snippet: 
 
document.getElementById('refresh').onclick = () => { 
    this.pivotObj.dataSourceSettings.dataSource = Pivot_Data2; 
}; 
 
 

If this doesn’t resolve your problem, then kindly reproduce the problem in the provided sample and revert us (or) send your sample that replicating the problem. This would be a very helpful for us to investigate the reported problem at our end and provide the solution at earliest. 
 
Thanks, 
Manikandan. 



RA Rainer February 17, 2020 10:41 AM UTC

Sorry, it only works if you assign a new this.dataSourceSettings object with the new data source. set.
Best regards
Rainer


SN Sivamathi Natarajan Syncfusion Team February 18, 2020 11:26 AM UTC

Hi Rainer, 
 
We are unable to understand your exact requirement in your last update. So, could you please provide us more information about the same with code example/images/video (if possible). This would be helpful for us to proceed further. 
 
Regards, 
Sivamathi. 



RA Rainer February 18, 2020 11:28 AM UTC

Hi support,
I found a workaround, you can close the issue.
Thanks
Rainer


SN Sivamathi Natarajan Syncfusion Team February 19, 2020 05:22 AM UTC

Hi Rainer, 
 
Thanks for the response. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Sivamathi. 



MK Muhammad Khizar replied to Rainer July 27, 2020 01:34 PM UTC

Hi support,
I found a workaround, you can close the issue.
Thanks
Rainer

sir i also facing this issue kindly send me solution. Thanks



SN Sivamathi Natarajan Syncfusion Team July 28, 2020 10:09 AM UTC

 
We would like to assist you, so could you please provide us more information about the reported problem with code example/images/video (if possible). This would be helpful for us to proceed further.  
  
Regards,  
Sivamathi.  


Loader.
Up arrow icon