Posted 22 August 2019, 3:18 am EST
Hi Lokesh,
As mentioned earlier SpreadJS serializes the sheet’s data source and the table’s data source as a cell value if the includeBindingSource argument of the toJSON method is true. So we cannot retrieve the data source after reloading the json.
However, if you have a requirement to store the spread template JSON and data source as separate values then you could simply set the includeBindingSource flag to false and save the data source separately, then when reloading the JSON, bind the saved dataSource again after loading the JSON template. Please refer to the following code snippet:
// save spread JSON
var savedJSON = spread.toJSON();
// saving data source separately
var source = spread.getSheetFromName("Sheet1").getDataSource();
// reloading JSON
// load json template
spread.fromJSON(savedJSON);
// rebind the data source
spread.getSheetFromName("Sheet1").getDataSource(source, false); // pass second argument as false to skip resetting the sheet
API reference:
• setDataSource() method: http://help.grapecity.com/spread/SpreadSheets12/webframe.html#SpreadJS~GC.Spread.Sheets.Worksheet~setDataSource.html
Please let us know if this doesn’t work for you.
Regards