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…
Forums Home / Spread / SpreadJS
Posted by: pedro.moraes on 10 August 2023, 2:21 pm EST
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);
Please let us know if you face any issues.
Regards,
Ankit