Select Library: Event and Method Examples
Category: ExamplesThe Select module enables single and multiple selection, perfectly replacing the native select-single and select-multiple components; it supports fuzzy search and auto-completion.
select and deselect Methods
The select method can add one or more options; the deselect method can remove one or more options. Both methods support two parameters:
In non-manual mode, newly added items should be inherent to the dropdown list. In manual mode, there are no restrictions on adding selected items.
selectAll and clear Methods
The selectAll method fills in all valid options from the list; clear removes all values. Both methods support one parameter - a callback function that takes no parameters.
disable and enable Methods
These methods respectively disable and re-enable the module, performing opposite operations with no parameters.
In disabled state, form submission will be unavailable.
update and reset Methods
The update method updates instance parameters, while reset restores the instance to its initial state.
getVals Method
The getVals method retrieves current values, returning an object with these properties:
Destruction and Initialization
If an instance is no longer needed, the destroy method can be used to destroy it. Although the instance becomes unusable, it remains in memory. To restore functionality, use the init method to reinitialize it.
Data Caching
Setting the storName parameter enables data caching, requiring this value to be unique. The core method for implementing caching is updateCache, while clearCache can be used to clear the cache.
