-
Notifications
You must be signed in to change notification settings - Fork 18
Widgets Methods v7
- status: complete
- version: 7.x
- follows from: Widgets Options
All widgets implement a set of standard methods:
- getValues: gets/sets the current selection of the widget (when available).
- setValues: gets/sets the current selection of the widget (when available).
- reset: resets the internal state of the widget and its appereance.
-
highlight: highlights the widget in some way, usually indicating an error;
emits
highlighted
. -
unhighlight: undoes the call to highlight; emits
unhighlighted
. -
hide: makes the widget completely invisible; emits
hidden
. -
show: makes the widget visible; emits
shown
. - toggle: shows the widget if hidden, and vice versa.
-
disable: the widget stays visible, but user cannot interact with it; emits
disabled
. -
enable: undoes a previous call to disable; emits
enabled
. -
collapse: Collapses the widget (hides the body and footer); emits
collapsed
. -
uncollapse: Collapses the widget (hides the body and footer); emits
uncollapsed
. - addFrame: Adds a border and margins around the bodyDiv element.
- removeFrame: Removes a border and margins around the bodyDiv element.
- isHighlighted: Returns TRUE if widget is currently highlighted.
- isDocked: Returns TRUE if widget is currently docked.
- isCollapsed: Returns TRUE if widget is currently collapsed.
- isDisabled: Returns TRUE if widget is currently disabled.
- isHidden: Returns TRUE if widget is currently hidden.
- isAppended: Returns TRUE if widget has been appended.
- isActionRequired: Returns TRUE if widget requires user action.
- setTitle: writes content to the HTML title of the widget.
- setFooter: writes content to the HTML footer of the widget.
- setContext: sets the Bootstrap context class, i.e. 'primary', 'info', 'success', 'warning', or 'danger.'
-
destroy: removes any listener defined by the widget, removes HTML created
by the widget from the DOM, and removes its reference from
node.widgets.instances
andnode.widgets.lastAppended
; emitsdestroyed
.
-
getText: Returns the requested text.
-
getTexts: Returns an object with selected texts.
-
getAllTexts: Returns an object with all current texts.
-
setText(requestedText, newText)
: Checks the value ofrequestedText
and assigns the value ofnewText
to it for display. -
setTexts: Assigns multiple texts at the same time.
-
getSound: Returns the requested sound path.
-
getSounds: Returns an object with selected sounds (paths).
-
getAllSounds: Returns an object with all current sounds.
-
setSound: Checks and assigns the value of a sound to play.
-
setSounds: Assigns multiple sounds at the same time.
-
on: Registers an event listener for the widget.
-
off: Removes an event listener from the widget.
-
emit: Emits an event within the widget; only the following predefined events can be emitted:
- 'hidden',
- 'shown',
- 'collapsed',
- 'uncollapsed',
- 'disabled',
- 'enabled',
- 'destroyed',
- 'highlighted',
- 'unhighlighted'.
Other custom events can be emitted with node.emit.
Go back to the wiki Home.
Copyright (C) 2021 Stefano Balietti
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.