Jx.Button.Combo

Extends: Jx.Button.Multi

A drop down list of selectable items.  Items can be either a string, an image or both.

Example

new Jx.Button.Combo({
    label: 'Choose a symbol',
    items: [
        {label: 'Star', image: 'images/swatches.png', imageClass: 'comboStar'},
        {label: 'Square', image: 'images/swatches.png', imageClass: 'comboSquare'},
        {label: 'Triangle', image: 'images/swatches.png', imageClass: 'comboTriangle'},
        {label: 'Circle', image: 'images/swatches.png', imageClass: 'comboCircle'},
        {label: 'Plus', image: 'images/swatches.png', imageClass: 'comboPlus'},
        {label: 'Cross', image: 'images/swatches.png', imageClass: 'comboCross'}
    ],
    onChange: function(combo) { alert('you selected ' + combo.getValue()) }
})

Events

changetriggered when the user selects a new item from the list

License

Copyright © 2008, DM Solutions Group Inc.

This file is licensed under an MIT style license

Summary
Jx.Button.ComboExtends: Jx.Button.Multi
Properties
currentSelection{Object} current selection in the list
Options
editableboolean, default false.
labelstring, default ‘’.
Constructor
Jx.Combocreate a new instance of Jx.Combo
Functions
setEnabledenable or disable the combo button.
valueChangedinvoked when the current value is changed
onKeyPressHandle the user pressing a key by looking for an ENTER key to set the value.
addadd a new item to the pick list
removeRemove the item at the given index.
TODO
implement remove?
Functions
setValueset the value of the Combo
getValueReturn the current value

Properties

currentSelection

{Object} current selection in the list

Options

editable

boolean, default false.  Can the value be edited by the user?

label

string, default ‘’.  The label to display next to the combo.

Constructor

Jx.Combo

create a new instance of Jx.Combo

Parameters

options<Jx.button.Combo.Options>

Functions

setEnabled

setEnabled: function(enabled)

enable or disable the combo button.

Parameters

enabled{Boolean} the new enabled state of the button

valueChanged

valueChanged: function()

invoked when the current value is changed

onKeyPress

onKeyPress: function(e)

Handle the user pressing a key by looking for an ENTER key to set the value.

Parameters

e{Event} the keypress event

add

add: function()

add a new item to the pick list

Parameters

options{Object} object with properties suitable to be passed to a <Jx.Menu.Item.Options> object.  More than one options object can be passed, comma separated or in an array.

remove

remove: function(idx)

Remove the item at the given index.  Not implemented.

Parameters

idx{Integer} the item to remove.

TODO

implement remove?

Functions

setValue

setValue: function(value)

set the value of the Combo

Parameters

value{Object} the new value.  May be a string, a text node, or another DOM element.

getValue

getValue: function()

Return the current value

Returns

{Object} returns the currently selected item

Extends: Jx.Button
setEnabled: function(enabled)
enable or disable the combo button.
valueChanged: function()
invoked when the current value is changed
onKeyPress: function(e)
Handle the user pressing a key by looking for an ENTER key to set the value.
add: function()
add a new item to the pick list
remove: function(idx)
Remove the item at the given index.
setValue: function(value)
set the value of the Combo
getValue: function()
Return the current value