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

Save and load dataSource properties

Hello, I consult you about the dataSource property of the Pivot Gid. I am using the component in a form and I need to save the following dataSource properties: ['values', 'rows', 'columns', 'calculatedFieldSettings', 'filterSettings', 'sortSettings'].
When editing the form, the properties are set in the dataSource and everything works perfect; but when saving the changes I get an error 'Converting circular structure to JSON' because the properties were set as instances of t in the dataSource instead of appearing as an array.
Is there any solution?
regards

1 Reply

DB Dinesh Babu Yadav Syncfusion Team July 1, 2019 06:28 AM UTC

Hi Alex, 
 
Thank you 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 Example :  
savebutton.element.onclick = function () { 
    //You can get the report and save into the database here. 
    var dataSource = JSON.parse(pivotGridObj.getPersistData()).dataSource; 
    localStorage.pivotReport = JSON.stringify(dataSource); 
}; 
      loadbutton.element.onclick = function () { 
      //You can fetch the report and load it here. 
      var dataSource = JSON.parse(localStorage.pivotReport); 
      pivotGridObj.dataSource = dataSource; 
  }; 
 
 
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 


Loader.
Live Chat Icon For mobile
Up arrow icon