Jx.Button.Multi

Extends: Jx.Button

Implements

Multi buttons are used to contain multiple buttons in a drop down list where only one button is actually visible and clickable in the interface.

When the user clicks the active button, it performs its normal action.  The user may also click a drop-down arrow to the right of the button and access the full list of buttons.  Clicking a button in the list causes that button to replace the active button in the toolbar and performs the button’s regular action.

Other buttons can be added to the Multi button using the add method.

This is not really a button, but rather a container for buttons.  The button structure is a div containing two buttons, a normal button and a flyout button.  The flyout contains a toolbar into which all the added buttons are placed.  The main button content is cloned from the last button clicked (or first button added).

The Multi button does not trigger any events itself, only the contained buttons trigger events.

Example

var b1 = new Jx.Button({
    label: 'b1',
    onClick: function(button) {
        console.log('b1 clicked');
    }
});
var b2 = new Jx.Button({
    label: 'b2',
    onClick: function(button) {
        console.log('b2 clicked');
    }
});
var b3 = new Jx.Button({
    label: 'b3',
    onClick: function(button) {
        console.log('b3 clicked');
    }
});
var multiButton = new Jx.Button.Multi();
multiButton.add(b1, b2, b3);

License

Copyright © 2008, DM Solutions Group Inc.

This file is licensed under an MIT style license

Summary
Jx.Button.MultiExtends: Jx.Button
Properties
{<Jx.Button>} activeButtonthe currently selected button
buttons{Array} the buttons added to this multi button
Constructor
Jx.Button.Multiconstruct a new instance of Jx.Button.Multi.
Functions
addadds one or more buttons to the Multi button.
removeremove a button from a multi button
setActiveButtonupdate the menu item to be the requested button.
setButtonupdate the active button in the menu item, trigger the button’s action and hide the flyout that contains the buttons.

Properties

{<Jx.Button>} activeButton

the currently selected button

buttons

{Array} the buttons added to this multi button

Constructor

Jx.Button.Multi

construct a new instance of Jx.Button.Multi.

Functions

add

add: function()

adds one or more buttons to the Multi button.  The first button added becomes the active button initialize.  This function takes a variable number of arguments, each of which is expected to be an instance of Jx.Button.

Parameters

button{Jx.Button} a Jx.Button instance, may be repeated in the parameter list

remove

remove: function(button)

remove a button from a multi button

Parameters

button{Jx.Button} the button to remove

setActiveButton

setActiveButton: function(button)

update the menu item to be the requested button.

Parameters

button{Jx.Button} a Jx.Button instance that was added to this multi button.

setButton

setButton: function(button)

update the active button in the menu item, trigger the button’s action and hide the flyout that contains the buttons.

Parameters

button{Jx.Button} The button to set as the active button
Extends: Object
add: function()
adds one or more buttons to the Multi button.
remove: function(button)
remove a button from a multi button
setActiveButton: function(button)
update the menu item to be the requested button.
setButton: function(button)
update the active button in the menu item, trigger the button’s action and hide the flyout that contains the buttons.