How to hide a sheet permanently?

Posted by: grapecity on 19 March 2020, 3:29 am EST

    • Post Options:
    • Link

    Posted 19 March 2020, 3:29 am EST

    Hi,

    I know I can hide sheets with

    mySpread.sheets[index].visible(false);
    

    But I noticed that I can make hidden sheets visible again with > right-click on a visible sheet > Unhide.

    Imagine that certain sheets contain sensible data that I need in my calculations, but don’t want my users to see.

    How can I hide individual sheets in a way that my users can not unhide them?

    Thanks!

    Ingmar

  • Posted 19 March 2020, 6:20 pm EST

    Hi Ingmar,

    SpreadJS allows us to easily customize the context-menu options. To remove the ‘unhide’ sheet option from the context we could set its workArea to null. Please refer to the following code snippet and the sample demonstrating the same:

    spread.contextMenu.menuData.forEach(function(menuOption) {
        if (menuOption.name === "gc.spread.unhideSheet") {
          menuOption.workArea = null;
        }
      });
    

    https://codesandbox.io/s/spread-js-starter-z8j7z

    Regards

    Sharad

  • Posted 19 March 2020, 7:39 pm EST

    Hello Sharad,

    aha. Well, thank you. Your solution work fine for me.

    But how about applications where sensitive data needs to be hidden permanently, while users may still want to hide/unhide sheets that are not critical?

    Maybe “permanet hiding” could be a helpful improvement your great component?

    Anyway, I have what I need for now. Thank you so much!

    Ingmar

  • Posted 22 March 2020, 7:55 pm EST

    Hi Ingmar,

    For this, you may override the onOpenMenu method of the contextMenu and toggle the disable state of unhide option as required. Please refer to the following sample which demonstrates the same:

    https://codesandbox.io/s/spread-js-starter-kqb0z

    Regards

  • Posted 22 March 2020, 9:08 pm EST

    That’s awesome. Thank you so much for your idea and work to create this snippet!!

Need extra support?

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

Learn More

Forum Channels