ViewerSelect#
- class jdaviz.core.template_mixin.ViewerSelect(**kwargs: Any)[source]#
Bases:
SelectPluginComponent
Plugin select for viewers, with support for single or multi-selection.
Useful API methods/attributes:
selected
select_all()
(only ifis_multiselect
)select_none()
(only ifis_multiselect
)
Traitlets (in the object, custom traitlets in the plugin):
items
(list of dicts with keys: id, reference, label)selected
(string)
Properties (in the object only):
ids
(list of ids corresponding toitems
)references
(list of references corresponding toitems
)labels
(list of references falling back on ids corresponding toitems
. Theseare the values seen in the dropdown, although setting either id or reference to the traitlet will still process correctly)
selected_item
(dict of the currently selected entry initems
)selected_id
(string corresponding to the id ofselected_item
)selected_obj
(viewer item corresponding toselected
)
To use in a plugin:
create traitlets with default values
register with all the automatic logic in the plugin’s init by passing the string names of the respective traitlets
use component in plugin template (see below)
refer to properties above based on the interally stored reference to the instantiated object of this component
Example template (label and hint are optional):
<plugin-viewer-select :items="viewer_items" :selected.sync="viewer_selected" label="Viewer" hint="Select viewer." />
This extends BasePluginComponent for common functionality for a select/dropdown component. The subclasses MUST have an
items
traitlet as a list of dictionaries, with ‘label’ as the selection entry (and any other optional entries for styling, etc) and aselected
string traitlet. The subclasses should also overrideselected_obj
and may choose to override_selected_changed
(likely with a super call to keep the base logic).Attributes Summary
Methods Summary
add_filter
(*filters)Attributes Documentation
- ids#
- references#
- selected_id#
- selected_obj#
- selected_reference#
Methods Documentation