Visible and Enable Context

Posted by: pedro.moraes on 10 August 2023, 2:21 pm EST

    • Post Options:
    • Link

    Posted 10 August 2023, 2:21 pm EST

    Hi,

    How do I know the list of all the values ​​of each command map default? Like visibleContext, enableContext…

  • Posted 11 August 2023, 7:55 am EST

    Hi Pedro,

    Currently, there is no documentation available for the list of all the visibleContext and enableContext options available as they are meant for the internal use only.

    If you are facing any issues in any of the functionality implementation, kindly let us know. We will surely help you with it.

    Regards,

    Ankit

  • Posted 11 August 2023, 8:24 am EST - Updated 11 August 2023, 8:26 am EST

    I got it,

    I would like to add some visibility rules that I created without overwriting the ones that already exist in the commandmap

    For example

    'gc.spread.contextMenu.insertRows': {
            text: this.translateService.instant('MEMORIA_CALCULO.INSERT'),
            commandName: 'gc.spread.contextMenu.insertRows',
            visibleContext: 'myRuleVisible',
          },

    if I do that, internal rules are overridden

  • Posted 14 August 2023, 9:00 am EST

    Hi,

    You could get a command by using the getCommand method. For a command, you could get its enableContext. Later you could use the AND(“&&”) and OR(“||”) operator to set the visible rule with your own “myRuleVisible”.

    For example, refer to the following code snippet:

    // Get the Font Family Command
    var insertRowCommand = GC.Spread.Sheets.Designer.getCommand(GC.Spread.Sheets.Designer.CommandNames.InsertRows);
    
    config.commandMap = {
        "gc.spread.contextMenu.insertRows": {
            enableContext: "myRuleVisible && " + insertRowCommand.enableContext
        },
    }
    
    // Set the Config
    designer.setConfig(config);

    Sample: https://jscodemine.grapecity.com/share/MK0241GrKkuAdTRFfk8HSg/?IsEmbed=false&Theme=Unset&PreviewDirection=0&IsEditorShow=true&IsExplorerShow=true&IsPreviewShow=true&IsConsoleShow=true&IsRunBTNShow=false&IsResetBTNShow=false&IsOpenInCodemineBTNShow=false&PanelWidth=20&PanelWidth=50&PanelWidth=30&defaultOpen={"OpenedFileName"%3A["%2Fsrc%2Fapp.js"%2C"%2Findex.html"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.js"}

    Please let us know if you face any issues.

    Regards,

    Ankit

Need extra support?

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

Learn More

Forum Channels