ComboBox
Extend from $.fn.combo.defaults. Override defaults with $.fn.combobox.defaults.
Dependencies
- combo
Usage
The json data format sample:
Properties
The properties extend from combo, below is the added properties for combobox.
| Name | Type | Description | Default |
|---|---|---|---|
| valueField | string | The underlying data value name to bind to this ComboBox. | value |
| textField | string | The underlying data field name to bind to this ComboBox. | text |
| mode | string | Defines how to load list data when text changed. Set to 'remote' if the combobox loads from server. | local |
| url | string | A URL to load list data from remote. | null |
| method | string | The http method to retrieve data. | post |
| data | array | The list data to be loaded. | null |
| filter | function | Defines how to filter the local data when 'mode' setted to 'local'. The function takes two parameters: q: the user typed text. row: the list row data. Return true to allow the row to be displayed. |
|
| formatter | function | Defineds how to render the row. The function takes one parameter: row. | |
| loader | function(param,success,error) |
Defines how to load data from remote server. Return false can abort this action.
This function takes following parameters: param: the parameter object to pass to remote server. success(data): the callback function that will be called when retrieve data successfully. error(): the callback function that will be called when failed to retrieve data. |
json loader |
Events
The events extend from combo, below is the added events for combobox.
| Name | Parameters | Description |
|---|---|---|
| onBeforeLoad | param | Fires before a request is made to load data, return false to cancel this load action. |
| onLoadSuccess | none | Fires when remote data is loaded successfully. |
| onLoadError | none | Fires when remote data load error. |
| onSelect | record | Fires when user select a list item. |
| onUnselect | record | Fires when user unselect a list item. |
Methods
The methods extend from combo, below is the added or overridden methods for combobox.
| Name | Parameter | Description |
|---|---|---|
| options | none | Return the options object. |
| getData | none | Return the loaded data. |
| loadData | data | Load the locale list data. |
| reload | url | Request the remote list data. |
| setValues | values | Set the combobox value array. |
| setValue | value | Set the combobox value. |
| clear | none | Clear the combobox value. |
| select | value | Select the specified item. |
| unselect | value | Unselect the specified item. |