jQuery EasyUI Form Plugin - Spinner
jQuery EasyUI Plugins
Extends $.fn.validatebox.defaults. Override the default defaults via $.fn.spinner.defaults.
The spinner combines an editable text box with two small buttons, allowing users to select from a range of values. Similar to the combobox, the spinner lets users type a value, but it has no drop-down list. The spinner is the base component for creating other spinner components such as numberspinner, timespinner, and so on.
Depends on
- validatebox
Usage
The spinner should be created using JavaScript. Creating it from markup is not allowed.
$('#ss').spinner({
required:true,
increment:10
});
property
This property extends from the validatebox; the following are properties added for the spinner.
| 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 |
| value | string | The initial value. | |
| min | string | The minimum allowed value. | null |
| max | string | The maximum allowed value. | null |
| increment | number | The increment value when a spinner button is clicked. | 1 |
| editable | boolean | Defines whether the user can type a value directly into the text field. | true |
| disabled | boolean | Defines whether to disable the text field. | false |
| spin | function(down) | The function called when the user clicks a spinner button. The 'down' parameter indicates whether the user clicked the down button. |
Events
| Name | Parameters | Description |
|---|---|---|
| onSpinUp | none | Triggered when the user clicks the up spinner button. |
| onSpinDown | none | Triggered when the user clicks the down spinner button. |
Method
This method extends from the validatebox; the following are methods added for the spinner.
| Name | Parameters | Description |
|---|---|---|
| options | none | Return the options object. |
| destroy | none | Destroys the spinner component. |
| resize | width | Resets the component width. Pass the 'width' parameter to override the initial width. |
代码实例:
$('#ss').spinner('resize'); // resize with original width $('#ss').spinner('resize', 200); // resize with new width| onSelect | event | enable | none | Enable the component.| onSelect | event | disable | none | Disable the component.| onSelect | event | getValue | none | Get the component value.| onSelect | event | setValue | value | Set the component value.| 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. |
jQuery EasyUI Plugins