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.
Slots
JET components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.
-
contextMenu
-
The contextMenu slot is set on the
oj-menuwithin this element. This is used to designate the JET Menu that this component should launch as a context menu on right-click, Shift-F10, Press & Hold, or component-specific gesture. If specified, the browser's native context menu will be replaced by the JET Menu specified in this slot.The application can register a listener for the Menu's ojBeforeOpen event. The listener can cancel the launch via event.preventDefault(), or it can customize the menu contents by editing the menu DOM directly, and then calling refresh() on the Menu.
To help determine whether it's appropriate to cancel the launch or customize the menu, the ojBeforeOpen listener can use component API's to determine which table cell, chart item, etc., is the target of the context menu. See the JSDoc of the individual components for details.
Keep in mind that any such logic must work whether the context menu was launched via right-click, Shift-F10, Press & Hold, or component-specific touch gesture.
-
itemTemplate
-
The
itemTemplateslot is used to specify the template for rendering each item in the list. The slot content must be a <template> element. The content of the template could either include the <li> element, in which case that will be used as the root of the item. Or it can be just the content which excludes the <li> element.When the template is executed for each item, it will have access to the binding context containing the following properties:
- $current - an object that contains information for the current item. (See oj.ojTabBar.ItemTemplateContext or the table below for a list of properties available on $current)
- alias - if as attribute was specified, the value will be used to provide an application-named alias for $current.
Attributes
-
as :string
-
An alias for the current item when referenced inside the item template. This can be especially useful if oj-bind-for-each element is used inside the item template since it has its own scope of data access.
- Deprecated:
Since Description 6.2.0Set the alias directly on the template element using the data-oj-as attribute instead.
- Default Value:
''
Names
Item Name Property asProperty change event asChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-as-changed -
current-item :any
-
Key of the current item. Current item is the list item which is having active focus. Note that if currentItem is set to an item that is currently not available (not fetched or inside a collapsed parent node), then the value is ignored.
When the current item is changed, the
event.detailof thecurrentItemChangedevent will contain the following additional properties:
Name Type Description itemElement Current Item element - Default Value:
null
- Supports writeback:
true
Names
Item Name Property currentItemProperty change event currentItemChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-current-item-changed -
data :(oj.TableDataSource|oj.DataProvider|null) data :(oj.DataProvider.<K, D>|null)
-
The data source for the Tab Bar accepts either a oj.TableDataSource or oj.DataProvider. See the data source section in the introduction for out of the box data source types. If the data attribute is not specified, the child elements are used as content. If there's no content specified, then an empty list is rendered.
- Default Value:
null
Names
Item Name Property dataProperty change event dataChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-data-changed -
display :"all"|"icons"
-
Whether to display both the label and icons (
"all") or just the icons ("icons"). In the latter case, the label is displayed in a tooltip instead, unless a tooltip was already supplied at create time. Note:display="icons"is valid only whendrillMode=noneand tab bar is a flat list. It is also mandatory to provide icons for each item as stated in icons section.- Default Value:
all
Supported Values:
Value Description "all"Display both the label and icons. "icons"Display only the icons. Names
Item Name Property displayProperty change event displayChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-display-changed -
edge :"top"|"bottom"|"start"|"end"
-
The position of the Tab Bar. Valid Values: top, bottom, start and end.
- Default Value:
start
Supported Values:
Value Description "bottom"This renders list items horizontally. Generally used when tab bar placed on bottom of content section. "end"This renders list items vertically. Generally used when tab bar placed on right/end of content section. "start"This renders list items vertically. Generally used when tab bar placed on left/start of content section. "top"This renders list items horizontally. Generally used when tab bar placed on top of content section. Names
Item Name Property edgeProperty change event edgeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-edge-changed -
item :Object
-
The item property contains a subset of properties for items.
Names
Item Name Property itemProperty change event itemChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-item-changed -
(nullable) item.renderer :(((context: ojTabBar.ItemContext<K, D>) => void)|null)
-
The renderer function that renders the content of the item. See itemContext in the introduction to see the object passed into the renderer function. The function should return one of the following:
- An Object with the following property:
- insert: HTMLElement | string - A string or a DOM element of the content inside the item.
- undefined: If the developer chooses to manipulate the item element directly, the function should return undefined.
- Default Value:
null
Names
Item Name Property item.renderer - An Object with the following property:
-
(nullable) item.selectable :(((context: ojTabBar.ItemContext<K, D>) => boolean)|boolean)
-
Whether the item is selectable. See itemContext in the introduction to see the object passed into the selectable function.
- Default Value:
true
Names
Item Name Property item.selectable -
overflow :"popup"|"hidden"
-
Specifies the overflow behaviour. NOTE: This is only applicable when
edgeattribute set totop- Default Value:
hidden
Supported Values:
Value Description "hidden"overflow is clipped, and the rest of the content will be invisible. "popup"popup menu will be shown with overflowed items. Note that setting
overflowtopopupcan trigger browser reflow, so only set it when it is actually required.Names
Item Name Property overflowProperty change event overflowChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-overflow-changed -
reorderable :"enabled"|"disabled"
-
Specifies if the tabs can be reordered within the tab bar by drag-and-drop.
- Default Value:
disabled
- Since:
- 4.1.0
Supported Values:
Value Description "disabled"Disables reordering of items in tabbar. "enabled"Enables reordering of items in tabbar. Names
Item Name Property reorderableProperty change event reorderableChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-reorderable-changed -
selection :any
-
Item Key of currently selected list item. If the value is modified by an application, tab bar UI is modified to match the new value and the
event.detailof theselectionChangedevent will contain the following additional properties:
Name Type Description itemElement Selected Item element - Default Value:
null
- Supports writeback:
true
Names
Item Name Property selectionProperty change event selectionChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-changed -
translations :object|null
-
A collection of translated resources from the translation bundle, or
nullif this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.If the component does not contain any translatable resource, the default value of this attribute will be
null. If not, an object containing all resources relevant to the component.If this component has translations, their documentation immediately follows this doc entry.
Names
Item Name Property translationsProperty change event translationsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-translations-changed -
translations.accessible-reorder-after-item :string
-
Provides properties to customize the screen reader text when the tentative drop target is after a certain item.
- Default Value:
"After {item}"
- Since:
- 4.1.0
Names
Item Name Property translations.accessibleReorderAfterItem -
translations.accessible-reorder-before-item :string
-
Provides properties to customize the screen reader text when the tentative drop target is before a certain item.
- Default Value:
"Before {item}"
- Since:
- 4.1.0
Names
Item Name Property translations.accessibleReorderBeforeItem -
translations.accessible-reorder-touch-instruction-text :string
-
Provides properties to customize the screen reader touch instructional text for reordering items.
- Default Value:
"Double tap and hold. Wait for the sound then drag to rearrange."
- Since:
- 4.1.0
Names
Item Name Property translations.accessibleReorderTouchInstructionText -
translations.label-cut :string
-
Provides properties to customize the context menu cut label.
See the translations attribute for usage examples.
- Default Value:
"Cut"
- Since:
- 4.1.0
Names
Item Name Property translations.labelCut -
translations.label-paste-after :string
-
Provides properties to customize the context menu paste after label.
See the translations attribute for usage examples.
- Default Value:
"Paste After"
- Since:
- 4.1.0
Names
Item Name Property translations.labelPasteAfter -
translations.label-paste-before :string
-
Provides properties to customize the context menu paste before label.
See the translations attribute for usage examples.
- Default Value:
"Paste Before"
- Since:
- 4.1.0
Names
Item Name Property translations.labelPasteBefore -
translations.label-remove :string
-
Provides properties to customize the context menu remove label.
See the translations attribute for usage examples.
- Default Value:
"Remove"
- Since:
- 4.1.0
Names
Item Name Property translations.labelRemove -
(nullable) translations.msg-fetching-data :string
-
Provides properties to customize the message text used by Tab Bar when waiting for data.
See the translations attribute for usage examples.
- Default Value:
"Fetching Data..."
- Since:
- 4.0.0
Names
Item Name Property translations.msgFetchingData -
(nullable) translations.msg-no-data :string
-
Provides properties to customize the message text used by Tab Bar when there are no items.
See the translations attribute for usage examples.
- Default Value:
"No items to display."
- Since:
- 4.0.0
Names
Item Name Property translations.msgNoData -
(nullable) translations.overflow-item-label :string
-
Label for overflow menu button.
See the translations attribute for usage examples.
- Default Value:
"More"
- Since:
- 4.0.0
Names
Item Name Property translations.overflowItemLabel -
translations.remove-cue-text :string
-
Text cue for the removable tab, used as the aria-label for the close icon.
- Default Value:
"Removable"
- Since:
- 4.1.0
Names
Item Name Property translations.removeCueText -
(nullable) translations.selected-label :string
-
Provides text to read to screen reader when an item is selected.
See the translations attribute for usage examples.
- Default Value:
"selected"
- Since:
- 4.0.0
Names
Item Name Property translations.selectedLabel -
truncation :"none"|"progressive"
-
Truncation applies to the tab titles when there is not enough room to display all tabs.
- Default Value:
none
- Since:
- 4.1.0
Supported Values:
Value Description "none"tabs always take up the space needed by the title texts. "progressive"If not enough space is available to display all of the tabs, then the width of each tab title is restricted just enough to allow all tabs to fit. All tab titles that are truncated are displayed with ellipses. However the width of each tab title will not be truncated below $tabBarTruncatedLabelMinWidth. Names
Item Name Property truncationProperty change event truncationChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-truncation-changed
Context Objects
Each context object contains, at minimum, a subId property,
whose value is a string that identifies a particular DOM node in this element. It can have additional properties to further specify the desired node. See getContextByNode for more details.
Properties:
| Name | Type | Description |
|---|---|---|
subId |
string | Sub-id string to identify a particular dom node. |
Following are the valid subIds:
-
oj-tabbar-item
-
Context for the oj-tab-bar component's items.
Properties:
Name Type Description indexnumber the zero based item index keyObject | string the Key of the item
Events
-
ojAnimateEnd
-
Triggered when the default animation of a particular action has ended. Note this event will not be triggered if application cancelled the default animation on animateStart.
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information. -
ojAnimateStart
-
Triggered when the default animation of a particular action is about to start. The default animation can be cancelled by calling event.preventDefault.
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type Description actionstring the action that starts the animation. See animation section for a list of actions. elementElement the target of animation. endCallbackfunction():void if the event listener calls event.preventDefault to cancel the default animation, it must call the endCallback function when it finishes its own animation handling and when any custom animation ends. -
ojBeforeCurrentItem
-
Triggered before the current item is changed via the
currentItemproperty or via the UI. To prevent the item being focused, invokeevent.preventDefault().Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information. -
ojBeforeDeselect
-
Triggered immediately before a tab is deselected. To prevent the item being deselected, invoke
event.preventDefault().- Since:
- 4.1.0
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type Description fromKeyany the Key of the tab item being navigated from fromItemElement the tab item being navigated from toKeyany the Key of the tab item being navigated to toItemElement the tab item being navigated to -
ojBeforeRemove
-
Triggered before the item is removed via the UI. To prevent the item being removed, invoke
event.preventDefault().- Since:
- 4.1.0
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information. -
ojBeforeSelect
-
Triggered before this list item is selected. To prevent the item selection, invoke
event.preventDefault().Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information. -
ojDeselect
-
Triggered after a tab has been deselected.
- Since:
- 4.1.0
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type Description fromKeyany the Key of the tab item being navigated from fromItemElement the tab item being navigated from toKeyany the Key of the tab item being navigated to toItemElement the tab item being navigated to -
ojRemove
-
Triggered immediately after a tab is removed. This should be used to remove item from dom or from data source.
- Since:
- 4.1.0
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information. -
ojReorder
-
Triggered after reordering items within tabbar via drag and drop or cut and paste. This should be used to reorder item in dom or data source.
- Since:
- 4.1.0
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type Description itemElement Item to be moved position'before' | 'after' the drop position relative to the reference item. Possible values are "before" and "after". referenceElement the item where the moved items are drop on.
Methods
-
getContextByNode(node) : {(oj.ojTabBar.NodeContext.<K>|null)}
-
Returns an object with context for the given child DOM node. This will always contain the subid for the node, defined as the 'subId' property on the context object. Additional component specific information may also be included. For more details on returned objects, see context objects.
Parameters:
Name Type Argument Description nodeElement <not nullable>
The child DOM node Returns:
The context for the DOM node, ornullwhen none is found.- Type
- (oj.ojTabBar.NodeContext.<K>|null)
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty. The return type will be the same as the type of the property as specified in this API document. If the method is invoked with an incorrect property/subproperty name, it returns undefined.
Parameters:
Name Type Description propertystring The property name to get. Supports dot notation for subproperty access. - Since:
- 4.0.0
Returns:
- Type
- any
Example
Get a single subproperty of a complex property:
let subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2'); -
refresh() : {void}
-
Refreshes the visual state of the Tab Bar. JET components require a
refresh()after the DOM is programmatically changed underneath the component.This method does not accept any arguments.
Returns:
- Type
- void
-
setProperties(properties) : {void}
-
Performs a batch set of properties. The type of value for each property being set must match the type of the property as specified in this API document.
Parameters:
Name Type Description propertiesObject An object containing the property and value pairs to set. - Since:
- 4.0.0
Returns:
- Type
- void
Example
Set a batch of properties:
myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"}); -
setProperty(property, value) : {void}
-
Sets a property or a subproperty (of a complex property) and notifies the component of the change, triggering a [property]Changed event. The value should be of the same type as the type of the attribute mentioned in this API document.
Parameters:
Name Type Description propertystring The property name to set. Supports dot notation for subproperty access. valueany The new value to set the property to. - Since:
- 4.0.0
Returns:
- Type
- void
Example
Set a single subproperty of a complex property:
myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");
Type Definitions
-
ItemContext<K, D>
-
Properties:
Name Type Argument Description componentElementElement oj-tab-bar element datasourceoj.DataProvider.<K, D> <optional>
A reference to the data source object. (Not available for static content) indexnumber The index of the item, where 0 is the index of the first item. keyK The Key of the item. dataD The data object for the item. parentElementElement The list item element. The renderer can use this to directly append content. -
ItemTemplateContext
-
NodeContext<K>
-
Properties:
Name Type Description subIdstring Sub-id string to identify a particular dom node. indexnumber The index of the item, where 0 is the index of the first item. keyK The Key of the item.