Trigger sheet renaming mode

Posted by: k.szabariova on 8 July 2021, 8:29 am EST

    • Post Options:
    • Link

    Posted 8 July 2021, 8:29 am EST

    Hello, I know how to rename sheet by function, I know user can rename sheet by double clicking on the sheet name.

    But I have this use case: When user adds new sheet, the new sheet is added and it is in renaming mode, and focused. So user can start changing name of sheet right after adding it, without need to double click on sheet name.

    Is this possible? To programatically trigger sheet name edit mode?

  • Posted 9 July 2021, 7:03 am EST

    Hi Kristina,

    We are sorry but SpreadJS does not support this feature. You may use the SheetChangeEvent and rename the as the sheet gets inserted. Please refer to the following code snippet and attached sample that demonstrates the same.

    
      spread.bind(GC.Spread.Sheets.Events.SheetChanged, (e, args) => {
        if (args.propertyName === "insertSheet") {
          let newSheetName = prompt("Enter the new SheetName");
          if (newSheetName) {
            spread.commandManager().execute({
              cmd: "renameSheet",
              sheetName: args.sheetName,
              name: newSheetName
            });
          }
        }
      });
    
    

    sample: https://codesandbox.io/s/agitated-flower-p16nl?file=/src/index.js:287-656

    SheetChanged: https://www.grapecity.com/spreadjs/docs/v14/online/SpreadJS~GC.Spread.Sheets.Events~SheetChanged_EV.html

    Regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels