Posted 7 June 2019, 10:54 am EST
I need to deep copy (or duplicate) an individual flexsheet for grid manipulation without affected my angular website view of it. I am printing a PDF of my flexsheet workbook and need to alter the grid before I output it (special formatting, removing columns/rows). At the moment doing that with the reference to the displayed angular flexsheet grid means the view changes there instead of to just my PDF version.
Doing this to a via the following is still altering the main grid via typescripts pass by reference:
this.flexsheet.sheets.find(x => x.SheetOid === sheetOid).grid;
I have tried several different approaches, and am now hoping there is something built into wijmo to handle this.
// const desiredSheetGrid = this.flexsheet.sheets.find(x => x.SheetOid === sheetOid).grid;
// const desiredSheetGrid = JSON.parse(JSON.stringify(this.flexsheet.sheets.find(x => x.SheetOid === sheetOid).grid));
// const desiredSheetGrid = Object.assign({}, this.flexsheet.sheets.find(x => x.SheetOid === sheetOid).grid);
// const desiredSheetGrid = [...this.flexsheet.sheets.find(x => x.SheetOid === sheetOid).grid];
// const desiredSheetGrid = this.deepCopy(this.flexsheet.sheets.find(x => x.SheetOid === sheetOid).grid);
Is there a suggested way to duplicate a sheet in typescript?