jQuery EasyUI Form Plugin - Combo
jQuery EasyUI Plugins
Extends $.fn.validatebox.defaults. Override the default defaults via $.fn.combo.defaults.
The combo displays an editable text box and a drop-down panel on an HTML page. It is the base component used to create other complex combination components such as combobox, combotree, combogrid, and so on.
Depends on
- validatebox
- panel
Usage
The combo can be created from elements using JavaScript. Note that creating a combo from markup is not valid.
$('#cc').combo({
required:true,
multiple:true
});
property
This property extends from the validatebox; the following are properties added for the combo.
| Name | Type | Description | Default value |
|---|---|---|---|
| width | number | The width of the component. | auto |
| height | number | The height of the component. This property is 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 multiple selection is supported. | false |
| selectOnNavigation | boolean | Defines whether to select an item when navigating items by keyboard. Available since version 1.3.3. | true |
| separator | string | The separator for text when multiple items are selected. | , |
| 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 before searching, measured 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: { up: function(){}, down: function(){}, enter: function(){}, query: function(q){} }| onSelect | event |
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. |
Method
This method extends from the validatebox; the following are methods added for the combo.
| Name | Parameters | Description |
|---|---|---|
| options | none | Return 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. |
| 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. Available since version 1.3.3. |
用法实例:
$('#cc').combo('readonly'); // enable readonly mode $('#cc').combo('readonly', true); // enable readonly mode $('#cc').combo('readonly', false); // disable readonly mode| onSelect | event | validate | none | Validate the input value.| onSelect | event | isValid | none | Return the validation result.| onSelect | event | clear | none | Clear the component value.| onSelect | event | reset | none | Reset the component value. This method is available since version 1.3.2.| onSelect | event | getText | none | Get the input text.| onSelect | event | setText | none | Set the text value.| onSelect | event | getValues | none | Get an array of the component values.| onSelect | event | setValues | none | Set an array of the component values.| onSelect | event | getValue | none | Get the component value.| onSelect | event | setValue | none | Set the component value. |
jQuery EasyUI Plugins