Element: <oj-switcher>

Oracle® JavaScript Extension Toolkit (JET)
17.0.0

F92240-01

Since:
  • 4.0.0
Module:
  • ojswitcher

QuickNav

Attributes


The switcher element dynamically decides which child element should be made visible. It will make a child element visible only if its slot attribute's value matches with switcher's value property.

If child content is expensive to render, use oj-defer to defer rendering until child element is made visible.


<oj-switcher value="[[selectedValue]]">
 <div slot="home">...<div>
 <div slot="about">...<div>
 <div slot="settings">...<div>
 ...
</oj-switcher>


Usage

Signature:

interface SwitcherElement

Typescript Import Format
//To typecheck the element APIs, import as below.
import { SwitcherElement } from "ojs/ojswitcher";

//For the transpiled javascript to load the element's module, import as below
import "ojs/ojswitcher";

For additional information visit:

Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.


Attributes

value :string

value of the switcher. Setting value will make all child elements with matching slot attribute as visible and hides elements which are not matching.
Default Value:
  • ""
Names
Item Name
Property value
Property change event valueChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-value-changed

Methods

getProperty(property) : {any}

Retrieves a value for a property or a single subproperty for complex properties.
Parameters:
Name Type Description
property string The property name to get. Supports dot notation for subproperty access.
Returns:
Type
any

refresh : {void}

Refreshes the visual state of the component.
Returns:
Type
void

setProperties(properties) : {void}

Performs a batch set of properties.
Parameters:
Name Type Description
properties Object An object containing the property and value pairs to set.
Returns:
Type
void

setProperty(property, value) : {void}

Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a [property]Changed event.
Parameters:
Name Type Description
property string The property name to set. Supports dot notation for subproperty access.
value any The new value to set the property to.
Returns:
Type
void