Spread.Sheets Documentation
register Method
The name of the command.
The object that defines the command. * For example, the following code registers the changeBackColor command and then executes the command.
* var command = {
* canUndo: true,
* execute: function (context, options, isUndo) {
* var sheet = context.getSheetFromName(options.sheetName);
* var cell = sheet.getCell(options.row, options.col);
* if (isUndo) {
* cell.backColor(options._oldBackColor);
* } else {
* options._oldBackColor = cell.backColor();
* cell.backColor(options.backColor);
* }
* }
* };
* var spread = GC.Spread.Sheets.findControl(document.getElementById("ss"));
* var commandManager = spread.commandManager();
* commandManager.register("changeBackColor", command);
* commandManager.execute({cmd: "changeBackColor", sheetName: spread.getSheet(0).name(), row: 1, col: 2, backColor: "red"});
The key code.
true if the command uses the Ctrl key; otherwise, false.
true if the command uses the Shift key; otherwise, false.
true if the command uses the Alt key; otherwise, false.
true if the command uses the Command key on the Macintosh or the Windows key on Microsoft Windows; otherwise, false.
Registers a command with the command manager.
Syntax
var instance = new GC.Spread.Commands.CommandManager(context);
var value; // Type: any
value = instance.register(name, command, key, ctrl, shift, alt, meta);
function register( 
   name : string,
   command : Object,
   key : undefined,
   ctrl : boolean,
   shift : boolean,
   alt : boolean,
   meta : boolean
) : any;

Parameters

name
The name of the command.
command
The object that defines the command. * For example, the following code registers the changeBackColor command and then executes the command.
* var command = {
* canUndo: true,
* execute: function (context, options, isUndo) {
* var sheet = context.getSheetFromName(options.sheetName);
* var cell = sheet.getCell(options.row, options.col);
* if (isUndo) {
* cell.backColor(options._oldBackColor);
* } else {
* options._oldBackColor = cell.backColor();
* cell.backColor(options.backColor);
* }
* }
* };
* var spread = GC.Spread.Sheets.findControl(document.getElementById("ss"));
* var commandManager = spread.commandManager();
* commandManager.register("changeBackColor", command);
* commandManager.execute({cmd: "changeBackColor", sheetName: spread.getSheet(0).name(), row: 1, col: 2, backColor: "red"});
key
The key code.
ctrl
true if the command uses the Ctrl key; otherwise, false.
shift
true if the command uses the Shift key; otherwise, false.
alt
true if the command uses the Alt key; otherwise, false.
meta
true if the command uses the Command key on the Macintosh or the Windows key on Microsoft Windows; otherwise, false.
See Also

Reference

CommandManager class

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.