jQuery EasyUI Form Plugin - Combo
Extends from $.fn.validatebox.defaults. Overrides the default defaults with $.fn.combo.defaults.
The combo displays an editable text box and a drop-down panel on the html page. It is the base component for creating other complex combo components (such as combobox, combotree, combogrid, etc.).
Dependencies
- validatebox
- panel
Usage
The combo can be created from a <select> or <input> element using JavaScript. Note that creating a combo from markup is invalid.
<input id="cc" value="001">
$('#cc').combo({
required: true,
multiple: true
});
Properties
This property extends from validatebox. The following properties are added for combo.
Name | Type | Description | Default Value |
---|---|---|---|
width | number | The width of the component. | auto |
height | number | The height of the component. Available since version 1.3.2. | 22 |
panelWidth | number | The width of the drop-down panel. | null |
panelHeight | number | The height of the drop-down panel. | 200 |
multiple | boolean | Defines whether to support multiple selection. | false |
selectOnNavigation | boolean | Defines whether to select the item when navigating with the keyboard. Available since version 1.3.3. | true |
separator | string | The separator for the text when multiple selections are made. | , |
editable | boolean | Defines whether the user can type text directly into the text field. | true |
disabled | boolean | Defines whether to disable the text field. | false |
readonly | boolean | Defines whether the component is read-only. Available since version 1.3.3. | false |
hasDownArrow | boolean | Defines whether to show the down arrow button. | true |
value | string | The default value. | |
delay | number | The delay for searching from the last key input event. | 200 |
keyHandler | object | The function called after the user presses a key. The default keyHandler is defined as follows: keyHandler: {<br> up: function(){},<br> down: function(){},<br> enter: function(){},<br> query: function(q){}<br>} |
Events
Name | Parameters | Description |
---|---|---|
onShowPanel | none | Triggered when the drop-down panel is shown. |
onHidePanel | none | Triggered when the drop-down panel is hidden. |
onChange | newValue, oldValue | Triggered when the value of the text field changes. |
Methods
This method extends from validatebox. The following methods are added for combo.
Name | Parameters | Description |
---|---|---|
options | none | Returns the options object. |
panel | none | Returns the drop-down panel object. |
textbox | none | Returns the text box object. |
destroy | none | Destroys the component. |
resize | width | Resizes the component width. |
showPanel | none | Shows the drop-down panel. |
hidePanel | none | Hides the drop-down panel. |
disable | none | Disables the component. |
enable | none | Enables the component. |
readonly | mode | Enables/disables read-only mode. This method is available since version 1.3.3. <br>Usage example: $('#cc').combo('readonly'); // enable readonly mode<br>$('#cc').combo('readonly', true); // enable readonly mode<br>$('#cc').combo('readonly', false); // disable readonly mode |
validate | none | Validates the input value. |
isValid | none | Returns the validation result. |
clear | none | Clears the component value. |
reset | none | Resets the component value. This method is available since version 1.3.2. |
getText | none | Gets the input text. |
setText | none | Sets the text value. |
getValues | none | Gets the array of component values. |
setValues | none | Sets the array of component values. |
getValue | none | Gets the component value. |
setValue | none | Sets the component value. |