Constructor
new Spinner(type, list_or_formatopt, minopt, maxopt, stepopt)
Creates a new Spinner component for selecting numbers, list items, dates/times, or IP addresses.
| Name | Type | Attributes | Description |
|---|---|---|---|
type | Spinner. | Spinner value type. Valid values are Spinner.DataType.[Number|List|DateTime] | |
list_or_format | string | | <optional> | Format of how the value should be displayed (for numbers), or Array of list items (when type is Spinner.DataType.List). |
min | number | <optional> | The minimum allowed value (numeric or date) |
max | number | <optional> | The maximum allowed value (numeric or date). |
step | number | | <optional> | Step increment used when increasing/decreasing values. Pass |
// Number Type: new Spinner(type, format, min, max, step_size);
new Spinner(Spinner.Type.Number, "0.00", 0, 100, 5);// List Type: new Spinner(new Array());
new Spinner(Spinner.Type.List, ["Monday","Tuesday","Wednesday","Thursday","Friday"]);// DateTime type:
new Spinner(Spinner.Type.DateTime, new Date(2000, 0, 1), new Date(2030, 11, 31), "yyyy-MM-dd", Spinner.Step.DayOfMonth);Classes
Members
(readonly) Step :number
Enumeration of step units for {Spinner.Type.DateTime} spinners. Used to define the unit that is incremented or decremented when changing the value.
- number
(readonly) Type :number
Enumeration of spinner value types. Used to define what kind of data the spinner will handle.
- number
(readonly) selectedText :string
Gets the currently selected text from the spinner's editable area.
- string
Methods
caretPosition(positionopt) → {number|Spinner}
Gets or sets the caret (cursor) position in the spinner's editable area.
| Name | Type | Attributes | Description |
|---|---|---|---|
position | number | <optional> | The caret position to set (0-based index). |
Returns current caret position when called without parameters, or the Spinner instance when setting.
- Type:
- number |
Spinner
deleteSelection() → {Spinner}
Deletes the currently selected text in the spinner's editable area.
The Spinner instance for method chaining.
- Type:
- Spinner
max(valueopt) → {number|null|Spinner}
Gets or sets the maximum allowed numeric value for the spinner. Applicable only if the spinner was initialized with {Spinner.Type.Number}, {Spinner.Type.DateTime} or {Spinner.Type.IPv4}. Returns null if spinner type is {Spinner.Type.List}.
| Name | Type | Attributes | Description |
|---|---|---|---|
value | number | <optional> | The maximum value to set. |
The current maximum value, null if not applicable, or the Spinner instance when setting.
- Type:
- number |
null | Spinner
min(valueopt) → {number|null|Spinner}
Gets or sets the minimum allowed numeric value for the spinner. Applicable only if the spinner was initialized with {Spinner.Type.Number}, {Spinner.Type.DateTime} or {Spinner.Type.IPv4}. Returns null if spinner type is {Spinner.Type.List}.
| Name | Type | Attributes | Description |
|---|---|---|---|
value | number | <optional> | The minimum value to set. |
The current minimum value, null if not applicable, or the Spinner instance when setting.
- Type:
- number |
null | Spinner
selectAll() → {this}
Selects all text in the spinner's editable area.
The Spinner instance for method chaining.
- Type:
- this
selection(startopt, endopt) → {Object|Spinner}
Get selection object {start, end}, or set the current selection range within the spinner's text.
| Name | Type | Attributes | Description |
|---|---|---|---|
start | number | <optional> | The start position of the selection (0-based index). |
end | number | <optional> | The end position of the selection (0-based index). |
Returns the current selection object when called without parameters, or the Spinner instance when setting.
- Type:
- Object |
Spinner
step(valueopt) → {number|null|Spinner}
Gets or sets the step increment/decrement for the spinner when changing values via arrows or keyboard. Applicable only if the spinner was initialized with {Spinner.Type.Number}, {Spinner.Type.DateTime}, or {Spinner.Type.IPv4}. Returns null if spinner type is {Spinner.Type.List}.
| Name | Type | Attributes | Description |
|---|---|---|---|
value | number | <optional> | The step size to set. |
The current step size, null if not applicable, or the Spinner instance when setting.
- Type:
- number |
null | Spinner