Posted 22 December 2020, 6:19 am EST
I would like to reorder the sheets using code. Is there a pattern or method to accomplish this?
Forums Home / Spread / SpreadJS
Posted by: jeff on 22 December 2020, 6:19 am EST
Posted 22 December 2020, 6:19 am EST
I would like to reorder the sheets using code. Is there a pattern or method to accomplish this?
Posted 22 December 2020, 7:46 pm EST
Hi Jeff,
We are unable to achieve the required functionality using the current public API hence we have escalated the issue to our Devs for further investigation. We will update you once they any information regarding the same. The internal tracking ID for this issue will be SJS-6993.
Regards
Avinash
Posted 23 December 2020, 6:44 am EST
If there is an acceptable way to accomplish this with the current API we would love to know.
Posted 23 December 2020, 7:37 pm EST
Hi Jeff,
We are sorry but we were unable to find a workaround to achieve this using the current API. We will let you know as soon as we get an update from the dev team.
Regards
Sharad
Posted 10 March 2021, 2:34 am EST
Since we don’t have an API for this.
I managed to do it in some hacky way.
// lets suppose we have 3 sheets A,B,C
const json = spread.toJSON();
console.log(json) // { sheets: A: {...}, B: {...}, C: {...}, ...rest}
json.sheets['A'].index = 2
json.sheets['C'].index = 0
spread.fromJSON(json)
// new sheet order C B A
Posted 23 August 2021, 10:06 am EST
Thank you very much Pedro!
Posted 1 November 2021, 5:58 pm EST
Hi,
I would like to ask, if here are any updates about re-ordering spreadsheet tabs using spread function?
Thank you
Posted 1 November 2021, 9:39 pm EST
Hi,
SpreadJS now provide a changeSheetIndex method that reorders the sheet. Please refer to the following code snippet and let me know if you ace any issues.
spread.changeSheetIndex("Sheet1", 3);
changeSheetIndex: https://www.grapecity.com/spreadjs/docs/v14/online/SpreadJS~GC.Spread.Sheets.Workbook~changeSheetIndex.html
Regards
Avinash