Constructor
new ComboField(choicesopt, makeChoicesopt, fastFactoropt, filterEnabledopt, filterFuncopt, …args)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
choices |
Array.<Object> |
<optional> |
choices (pairs of |
makeChoices |
function |
<optional> |
a function that generates choices (see
|
fastFactor |
Number |
<optional> |
determines how fast the page-up/page-down actions work (defaults to |
filterEnabled |
Boolean |
<optional> |
set to |
filterFunc |
function |
<optional> |
custom filtering function (see
|
args |
* |
<repeatable> |
parent class parameters |
Extends
Methods
clearApplied()
Put the field in the normal state, but only if the current state is qui.forms.STATE_APPLIED
.
- Overrides:
- Source:
clearChanged()
Clear the changed flag.
- Overrides:
- Source:
disable()
Disable the field.
- Overrides:
- Source:
(abstract) disableWidget()
Disable the widget.
Override this to implement how the widget is disabled.
- Overrides:
- Source:
enable()
Enable the field.
- Overrides:
- Source:
(abstract) enableWidget()
Enable the widget.
Override this to implement how the widget is enabled.
- Overrides:
- Source:
filterFunc(choice, searchText) → {Boolean}
Tell if a choice matches a search text or not.
Parameters:
Name | Type | Description |
---|---|---|
choice |
Object | |
searchText |
String |
Returns:
- Type
- Boolean
focus()
Focus the field.
- Overrides:
- Source:
getDescription() → {String}
Return the field description.
- Overrides:
- Source:
Returns:
- Type
- String
getForm() → {qui.forms.Form}
Return the owning form.
- Overrides:
- Source:
Returns:
- Type
- qui.forms.Form
getLabel() → {String}
Return the field label.
- Overrides:
- Source:
Returns:
- Type
- String
getName() → {String}
Return the field name.
- Overrides:
- Source:
Returns:
- Type
- String
getOrigValue() → {*}
Return the original field value (before user changes). The original value is always the last value that has been applied.
- Overrides:
- Source:
Returns:
- Type
- *
getUnit() → {String}
Return the field unit.
- Overrides:
- Source:
Returns:
- Type
- String
getValue() → {*}
Return the current field value.
- Overrides:
- Source:
Returns:
- Type
- *
getValueWidth() → (nullable) {Number}
Return the width percent of the value element.
- Overrides:
- Source:
Returns:
- Type
- Number
getWidget() → {jQuery}
Return the fields's widget.
- Overrides:
- Source:
Returns:
- Type
- jQuery
handleBlur()
Handle blur events.
- Overrides:
- Source:
handleChange(value)
Handle change events.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | new value |
- Overrides:
- Source:
handleFocus()
Handle focus events.
- Overrides:
- Source:
hasSeparator() → {Boolean}
Tell if the field has separator above.
- Overrides:
- Source:
Returns:
- Type
- Boolean
hide()
Hide the field.
- Overrides:
- Source:
initWidget(widget)
Initialize the widget's HTML element.
Override this to implement how the widget element is set up, after it has been created.
Parameters:
Name | Type | Description |
---|---|---|
widget |
jQuery | the widget's HTML element |
- Overrides:
- Source:
isApplied() → {Boolean}
Tell if the field data has been applied (and thus there are no pending changes).
- Overrides:
- Source:
Returns:
- Type
- Boolean
isChanged() → {boolean}
Tell if field has been changed since the last time it was applied.
- Overrides:
- Source:
Returns:
- Type
- boolean
isDescriptionVisible() → {Boolean}
Tell if the field description is visible or not.
- Overrides:
- Source:
Returns:
- Type
- Boolean
isDisabled() → {Boolean}
Tell if the field is disabled.
- Overrides:
- Source:
Returns:
- Type
- Boolean
isFocused() → {Boolean}
Tell if the field is focused or not.
- Overrides:
- Source:
Returns:
- Type
- Boolean
isForceOneLine() → {Boolean}
Return the value of the forceOneLine flag.
- Overrides:
- Source:
Returns:
- Type
- Boolean
isHidden() → {Boolean}
Tell if the field is hidden.
- Overrides:
- Source:
Returns:
- Type
- Boolean
isReadonly() → {Boolean}
Tell if the field is read-only.
- Overrides:
- Source:
Returns:
- Type
- Boolean
isRequired() → {Boolean}
Tell if the field is required.
- Overrides:
- Source:
Returns:
- Type
- Boolean
makeChoices() → {Array.<Object>}
Create choices.
Returns:
choices (pairs of label
and value
)
- Type
- Array.<Object>
makeDescriptionHTML() → {jQuery}
Create the description HTML element.
- Overrides:
- Source:
Returns:
- Type
- jQuery
makeErrorHTML() → {jQuery}
Create the error HTML element.
- Overrides:
- Source:
Returns:
- Type
- jQuery
makeLabelHTML() → {jQuery}
Create the label HTML element.
- Overrides:
- Source:
Returns:
- Type
- jQuery
makeSideIconHTML() → {jQuery}
Create the side icon HTML element.
- Overrides:
- Source:
Returns:
- Type
- jQuery
makeValueHTML() → {jQuery}
Create the value HTML element.
- Overrides:
- Source:
Returns:
- Type
- jQuery
makeWarningHTML() → {jQuery}
Create the warning HTML element.
- Overrides:
- Source:
Returns:
- Type
- jQuery
(abstract) makeWidget() → {jQuery}
Create the widget's HTML element.
Override this to implement how the widget element is created.
- Overrides:
- Source:
Returns:
- Type
- jQuery
onBlur()
Called whenever the field loses focus.
- Overrides:
- Source:
onChange(value, form)
Called whenever the field value is changed by the user.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | the new (unvalidated) field value |
form |
qui.forms.Form | the owning form |
- Overrides:
- Source:
onFocus()
Called whenever the field is focused.
- Overrides:
- Source:
setApplied()
Optionally put the field in the applied state qui.forms.STATE_APPLIED
.
- Overrides:
- Source:
setChoices(choices)
Set the list of choices.
Parameters:
Name | Type | Description |
---|---|---|
choices |
Array.<Object> | choices (pairs of |
setDescription(description)
Update the field description.
Parameters:
Name | Type | Description |
---|---|---|
description |
String |
- Overrides:
- Source:
setForm(form)
Set the owning form.
Parameters:
Name | Type | Description |
---|---|---|
form |
qui.forms.Form |
- Overrides:
- Source:
setLabel(label)
Update the field label.
Parameters:
Name | Type | Description |
---|---|---|
label |
String |
- Overrides:
- Source:
setReadonly(readonly)
Update the read-only state.
Parameters:
Name | Type | Description |
---|---|---|
readonly |
Boolean |
- Overrides:
- Source:
setRequired(required)
Update the required state.
Parameters:
Name | Type | Description |
---|---|---|
required |
Boolean |
- Overrides:
- Source:
setSeparator(separator)
Set the field separator.
Parameters:
Name | Type | Description |
---|---|---|
separator |
Boolean |
- Overrides:
- Source:
setSideIcon(icon, clickCallbackopt)
Show or hide the side icon, updating it according to the supplied icon.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
icon |
String | qui.icons.Icon | an icon or an icon type; passing
|
|
clickCallback |
function |
<optional> |
an optional function to be called when the icon is clicked; the function will
be called with the field as |
- Overrides:
- Source:
setUnit(unit)
Update the field unit.
Parameters:
Name | Type | Description |
---|---|---|
unit |
String |
- Overrides:
- Source:
setValue(value)
Update the current field value.
Parameters:
Name | Type | Description |
---|---|---|
value |
* |
- Overrides:
- Source:
setValueWidth(widthnullable)
Set the width percent of the value element.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
width |
Number |
<nullable> |
- Overrides:
- Source:
(abstract) setWidgetReadonly(readonly)
Update the read-only state of the widget.
Override this to implement how the widget's readonly state is modified.
Parameters:
Name | Type | Description |
---|---|---|
readonly |
Boolean |
- Overrides:
- Source:
show()
Show the field.
- Overrides:
- Source:
updateChoices()
Update the list of choices, calling makeChoices.
validate(value, data) → (nullable) {Promise.<*, qui.forms.ValidationError>}
Tell if a given value is valid or not.
Override this method to implement custom validation for this field.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | the value to validate |
data |
Object | the form data |
- Overrides:
- Source:
Throws:
qui.forms.ValidationError the validation error can also be thrown instead of being returned in a rejected response
Returns:
null
or a promise that resolves, if the value is valid; a
promise that rejects with a validation error otherwise
- Type
- Promise.<*, qui.forms.ValidationError>
validateWidget(value) → (nullable) {String}
Implement widget value validation.
Override this to implement validation for your widget.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | the value to validate |
- Overrides:
- Source:
Returns:
null
if the value is valid, or an error message otherwise; if an empty string is returned,
the value is considered invalid but no error message will be shown
- Type
- String
(abstract) valueToWidget(value)
Adapt and write a value to the widget.
Override this to implement how a value is set to the widget.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | the field value |
- Overrides:
- Source:
(abstract) widgetToValue() → {*}
Read value from the widget and adapt it to the field.
Override this to implement how a value is read from the widget.
- Overrides:
- Source:
Returns:
the field value
- Type
- *