Ribbon menu delete sheet

Posted by: nhan.thanh.nguyen on 17 May 2023, 2:53 pm EST

  • Posted 17 May 2023, 2:53 pm EST - Updated 17 May 2023, 3:11 pm EST

    Hi teams,

    Do we have any event that can trigger delete sheet in the ribbon menu function. I try to use ActiveSheetChanged, SheetChanged, SheetChanging to trigger but it does not work. After deleting, I want to call ActiveSheetChanged event or get a new current selection cell, do we have any ways to do this?

    I’m using spreadjs version 14.0.4 with reactjs

    I’m looking forward to hearing from you.

    Thanks and Best Regards,

    Nhan Nguyen

  • Posted 18 May 2023, 3:45 pm EST - Updated 18 May 2023, 3:50 pm EST

    Hi Nhan,

    I could see that the events are not getting trigged in the SpreadJS V14.0.4. You could upgrade to the SpreadJS V14.2.5 or later and override the “Designer.deleteSheet” command which gets triggered when you delete a sheet from the ribbon.

    Kindly refer to the following code snippet and the attached sample:

        // Override the Designer.deleteSheet command
        let oldDeleteSheetCmd = spread.commandManager()["Designer.deleteSheet"].execute;
        spread.commandManager()["Designer.deleteSheet"].execute = function (spread, options) {
          let result = oldDeleteSheetCmd.apply(this, arguments);
          console.log("Sheet Deleted");
          console.log("SheetName: " + options.sheetName);
          console.log("Selections: ");
          console.log(options.selections[0]);
          return result;
        }

    Kindly let us know if you face any problems.

    Regards,

    Ankit

    Sample: react.zip

Need extra support?

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

Learn More

Forum Channels