Class: module:bajaux/commands/ToggleCommandGroup

module:bajaux/commands/ToggleCommandGroup


new module:bajaux/commands/ToggleCommandGroup()

ToggleCommandGroup is a special CommandGroup that behaves like a radio button group

Extends:
  • bajaux/commands/CommandGroup
Parameters:
Name Type Description
params.onChange function

provide a callback function that can work with the selected value

params.commands Array

An array of objects, each of which will passthrough to making a
ToggleCommand.

See:
  • module:bajaux/commands/Command for all acceptable parameters. Pass a function 'selected' that will be called back after a single command is invoked. Pass an optional "value" parameter to associate a value with a command
Examples
ToggleCommandGroup({
      onChange: function(value){
        //do something with value
      },
      commands: [
        {
          module: "mymodule",
          lex : "mycommand1",
          value : 0
        },
        {
          module: "mymodule",
          lex : "mycommand2",
          value : 1
        },
        {
          module: "mymodule",
          lex : "mycommand3",
          value : 2
        }
      ]
    });
initializeParams: {
        toggleGroup: true
      }
Passing the above parameter additionally to a CommandButtonGroup that contains this ToggleGroup,
will provide a flat stype to your toggle group

Extends

  • bajaux/commands/CommandGroup

Methods


getSelected()

Get the selected command

Returns:

The selected ToggleCommand

Type
ToggleCommand

getSelectedValue()

Get the selected value if available

Returns:

If a 'value' parameter is set it will be returned

Type
any