Skip to content

Latest commit

 

History

History
57 lines (30 loc) · 1.65 KB

File metadata and controls

57 lines (30 loc) · 1.65 KB

API Methods

Back to documentation index

For some projects, it is easier to interact with components by API rather than props/emit. This is the main purpose of these API.

All these methods should be called directly on the component instance.

clearCache

clearCache(forceReset: boolean = false) => void

Whole cache in selectic are cleared, and so all options are re-fetched. This method is mainly useful in dynamic mode when data should be completely changed (due to some context change).

If forceReset is set to true, the current selection is also cleared. Otherwise it keeps previous selection.

changeTexts

changeTexts(texts: Object) => void

This method allows to change any texts used in the component.

More details about how to change texts in selectic.

getValue

getValue() => id | id[]

This method returns the ids of current selected options.

It returns a single id when not in multiple mode, and an array of id in multiple mode.

getSelectedItems

getSelectedItems() => option | option[]

This method returns the current selected options (which includes all information related to the option).

isEmpty

isEmpty() => boolean

This method checks if there is a selection.

It returns false if there are no selected options and true if there is at least one selected option.

toggleOpen

toggleOpen(open?: boolean) => boolean

This methods force the "open" state of the component.

if open is not set, it toggles the current state.

It returns the final state. Keep in mind that the state can be changed immediately afterward by automatic settings (like autoDisabled).