Extends: Jx.Button
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.
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);Copyright © 2008, DM Solutions Group Inc.
This file is licensed under an MIT style license
| Jx. | Extends: Jx.Button |
| Properties | |
| {<Jx. | the currently selected button |
| buttons | {Array} the buttons added to this multi button |
| Constructor | |
| Jx. | construct a new instance of Jx.Button.Multi. |
| Functions | |
| add | adds one or more buttons to the Multi button. |
| remove | remove a button from a multi button |
| setActiveButton | update the menu item to be the requested button. |
| setButton | update the active button in the menu item, trigger the button’s action and hide the flyout that contains the buttons. |
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.
| button | {Jx.Button} a Jx.Button instance, may be repeated in the parameter list |
remove: function( button )
remove a button from a multi button
| button | {Jx.Button} the button to remove |
setButton: function( button )
update the active button in the menu item, trigger the button’s action and hide the flyout that contains the buttons.
| button | {Jx.Button} The button to set as the active button |
adds one or more buttons to the Multi button.
add: function()
remove a button from a multi button
remove: function( button )
update the menu item to be the requested button.
setActiveButton: function( button )
update the active button in the menu item, trigger the button’s action and hide the flyout that contains the buttons.
setButton: function( button )