We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to Save Layout of changed field for Pivot Table on run time

Hi 
i am using Pivot Table control of JS2 for MVC 5 , 

i already enabled the the field list option ,it is a great option , but i have once concern if the there is an option to save the end-user modification of the layout to use it later ,
i found this article https://help.syncfusion.com/aspnet/pivotgrid/save-load but it is about ASP.NET form and version JS 1 

could anyone help me 

Thankx

1 Reply

DY Deivaselvan Y Syncfusion Team April 12, 2019 09:51 AM UTC

Hi Jasem, 
 
Thanks for contacting Syncfusion support. 
 
You can get the report at any time by using getPersistData method and save it into the database. Please refer the below code snippet. 
  
Code Snippet: 
document.getElementById("save-btn").addEventListener('click', function () { 
        var pivotGridObj = document.getElementById('PivotGrid').ej2_instances[0]; 
        var dataSource = JSON.parse(pivotGridObj.getPersistData()).dataSource; 
        localStorage.pivotReport = JSON.stringify(dataSource); 
}); 
document.getElementById("load-btn").addEventListener('click', function () { 
        var pivotGridObj = document.getElementById('PivotGrid').ej2_instances[0]; 
        var dataSource = JSON.parse(localStorage.pivotReport); 
        pivotGridObj.dataSource = dataSource; 
});  
 
 
Please let us know if you have any other queries. 
 
Regards,
Deivaselvan
 


Loader.
Live Chat Icon For mobile
Up arrow icon