Element: <oj-selector>

Oracle® JavaScript Extension Toolkit (JET)
15.1.0

F83698-01

Since:
  • 9.0.0
Module:
  • ojselector

QuickNav

Attributes


JET Selector

Description: A checkbox to support selection in Collection Components

The oj-selector is a component that may be placed within a template for Table, ListView. It presents as a checkbox when the Collection Component is configured for multi-selection. Note that the selector does not prevent click events from bubbling up to the containing element. In cases where an application wishes to prevent the containing element or component from performing a default action based on these click events, the application must ensure the appropriate updates are made (ie. setting the data-oj-clickthrough='disabled' attribute on a selector within an that does not include an ).


<oj-list-view id="listview"
     data="[[dataProvider]]"
     selected="{{selectedItems}}"
     selection-mode="[[selectedSelectionMode]]"
     scroll-policy="loadMoreOnScroll">
 <template slot="itemTemplate" data-oj-as="item">
   <li>
     <div class='oj-flex'>
       <div class="oj-flex-item">
         <oj-selector selected-keys='{{selectedItems}}'
                       selection-mode='[[selectedSelectionMode]]'
                       row-key='[[item.key]]'>
         </oj-selector>
       </div>
       <div class="oj-flex-item">
         <span data-bind="text: 'Name '+ item.data.name"></span>
       </div>
     </div>
   </li>
 </template>
</oj-list-view>

Accessibility

Application must specify a value for the aria-label attribute with a meaningful description of the purpose of this selector in order for this to be accessible.

Migration

Read about current Core Pack limitations to decide when to migrate.
Please make note of the following:

  • Deprecated APIs are not available in Core Pack, and are not documented in this migration section.
  • Before trying to migrate to Core Pack run the JET audits and fix any issues before proceeding.
  • The refresh() method is no longer supported in Core Pack. See the Core Pack Migration Guide for more information.

To migrate from oj-selector to oj-c-selector or oj-c-selector-all, you need to revise the import statement and references to oj-selector in your app. Please note the changes between the two components below.
selection-mode attribute

For selection-mode="single"|"multiple", please use oj-c-selector; for selection-mode="all", please use oj-c-selector-all.


Usage

Signature:

interface SelectorElement<K>

Generic Parameters
ParameterDescription
KType of key
Typescript Import Format
//To typecheck the element APIs, import as below.
import { SelectorElement } from "ojs/ojselector";

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

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

indeterminate :boolean

Specifies if the selector should show the visual partial state. The original checked state of the selector will still be maintained. User selection of checkboxes will remove the indeterminate state and reveal the checkbox state. Otherwise, programmatically changing the checkbox state will not change the indeterminate state.
Default Value:
  • false
Supports writeback:
  • true
Names
Item Name
Property indeterminate
Property change event indeterminateChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-indeterminate-changed

row-key :(K|null)

Specifies the row key of each selector. If the selectionMode property is 'all', rowKey is ignored.
Default Value:
  • null
Names
Item Name
Property rowKey
Property change event rowKeyChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-row-key-changed

selected-keys :(KeySet.<K>|null)

Specifies the selectedKeys, should be hooked into the collection component.
Default Value:
  • null
Supports writeback:
  • true
Names
Item Name
Property selectedKeys
Property change event selectedKeysChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selected-keys-changed

selection-mode :"all"|"multiple"|"single"

Specifies the selection mode ('single', 'multiple', 'all'). 'all' should only be used for the select all case and will ignore the key property.
Supported Values:
Value Description
all Specifies the select all case (rowKey property is ignored).
multiple Multiple items can be selected at the same time.
single Only a single item can be selected at a time.
Default Value:
  • 'multiple'
Names
Item Name
Property selectionMode
Property change event selectionModeChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-mode-changed
Example
<oj-selector selected-keys='{{selectedItems}}'
         selection-mode='all'>
</oj-selector>

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

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