JavaXT
|
|||||||||||||||
ComboBox ClassForm input with a pulldown list of options. By default, the options are accessed via a button or a "down arrow" key press. The list of options are automatically filtered as a user types in a value in the input field.
ConstructorsUsed to instantiate this class
Config Optionsplaceholder Placeholder text to display in the input. No placeholder text is set by default.
spellcheck If true, the browser will spellcheck text in the input field. Default is false.
maxVisibleRows The number of menu items to that appear in the dropdown menu before overflow. Default is 5.
scrollbar If true, will display a vertical scrollbar in the dropdown menu. Default is true.
showMenuOnFocus If true, will display the dropdown menu whenever the input has focus (e.g. on mouse click). Default is true.
typeAhead If true, the list of options in the dropdown menu are automatically filtered as a user types in a value in the input field. Default is true.
readOnly If true, will prevent user from typing or copy/pasting values in the input field. Default is false.
options A static list of options to put in the dropdown menu. Example:
[ { label: "Previous Year", value: "prevYear" }, { label: "Current Year", value: "currYear" }, { label: "Next Year", value: "nextYear" } ]Use the add() method to add items dynamically. addNewOption If true, will display a static menu item at the bottom of the drop down menu. This extra menu option is commonly used to render a popup menu/dialog. The onAddNewOption() method can be overridden to handle when this item is selected. The addNewOptionText config option is used to set the text/label for this menu option. Default is false.
addNewOptionText Text to display in the extra menu option when addNewOption is set to true. Default is "Add New..."
style Style for individual elements within the component. Note that you can provide CSS class names instead of individual style definitions.
EventsonAddNewOption( ) Called when a user clicks on the "new" menu option that appears at the bottom of the dropdown menu. See addNewOption config option. onMenuContext( label, value, el ) Called when a user attempts to render the context menu on a menu option onMenuHover( label, value, el ) Called when a user hovers over an item in the dropdown menu Public Methodsdisable( ) Used to disable the input preventing users from interacting with the component. reset( ) Similar to the clear() method, this will clears the input value. However, unlike the clear() method, this method will retain all the items in the dropdown menu. setValue( value, silent ) Used to set the value for the input.
getOptions( ) Returns an array of all the menu options currently available in the dropdown menu. Elements in the array will include a "text", "value", and "el" for each entry. Example:
[ { text: "United States", value: "US", el: div }, { text: "Mexico", value: "MX", el: div }, ... ] filter( ) Used to filter items in the dropdown menu that start with the text in the input. showMenu( removeFilter ) Renders the dropdown menu if it is hidden.
add( label, value ) Used to add an entry to the dropdown menu. Returns the new menu item as a DOM element with custom methods like setLabel()
|