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.ojNavigationList.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.
Properties of $current:
Name Type Description componentElementElement The <oj-navigation-list> custom element dataObject The data for the current item being rendered indexnumber The zero-based index of the current item keyany The key of the current item being rendered depthnumber The depth of the current item (available when hierarchical data is provided) being rendered. The depth of the first level children under the invisible root is 1. leafboolean True if the current item is a leaf node (available when hierarchical data is provided). parentkeyany The key of the parent item (available when hierarchical data is provided). The parent key is null for root nodes.
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 :K
-
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.TreeDataSource|oj.DataProvider|null) data :(oj.DataProvider.<K, D>|null)
-
The data source for the NavigationList accepts either a oj.TableDataSource or oj.TreeDataSource. 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 navigation list 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 -
drill-mode :"none"|"collapsible"|"sliding"
-
Defines style of navigation used to drill down hierarchical list items.
- none
- collapsible
- sliding
- Default Value:
none
Supported Values:
Value Description "collapsible"Allows user to expand and collapse group items. If there are more than two levels in hierarchy, slidingis preferred drill mode."none"All group items are expanded by default and user not allowed to collapse them. "sliding"This is typically used for hierarchical lists. This allows user to view one level at a time. Names
Item Name Property drillModeProperty change event drillModeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-drill-mode-changed -
edge :"top"|"start"
-
The position of the Navigation List. Valid Values: top and start.
NOTE: when value is
top,"none"is the only supported drillMode and it also does't support hierarchical items. That means TreeDataProvider/TreeDataSource are not supported as data source.- Default Value:
start
Supported Values:
Value Description "start"This renders list items vertically. "top"This renders list items horizontally. 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 -
expanded :oj.KeySet<K>
-
Specifies the key set containing the keys of the items that should be expanded. Use the ExpandedKeySet class to specify items to expand. Use the ExpandAllKeySet class to expand all items.
- Default Value:
new ExpandedKeySet();
- Supports writeback:
true
Names
Item Name Property expandedProperty change event expandedChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-expanded-changed -
hierarchy-menu-threshold :number
-
Specifies the level at which user can see hiearchical menu button.This is only valid when
drillModeset tosliding. Default value is 0, shows hiearchical menu always. If value is -1, then it will never be shown.The default value for hierarchyMenuThreshold varies by theme. Each theme can set its default by setting
$navigationListHierarchyMenuDisplayThresholdLevelOptionDefaultas seen in the example below.- Default Value:
0
Names
Item Name Property hierarchyMenuThresholdProperty change event hierarchyMenuThresholdChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-hierarchy-menu-threshold-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: ojNavigationList.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: ojNavigationList.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
- Since:
- 3.0.0
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 -
(nullable) root-label :string
-
Label for top level list items.
NOTE: This is needed only for sliding navigation list where this will be used as title for the top level list elements.
- Default Value:
Navigation List
Names
Item Name Property rootLabelProperty change event rootLabelChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-root-label-changed -
selection :K
-
Item Key of currently selected list item. If the value is modified by an application, navigation list 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 -
(nullable) translations.default-root-label :string
-
Provides properties to customize the title text used by Sliding Navigation List for root node.
See the translations attribute for usage examples.
- Default Value:
"Navigation List"
- Since:
- 1.1.0
Names
Item Name Property translations.defaultRootLabel -
(nullable) translations.hier-menu-btn-label :string
-
Provides properties to customize the hover message text used by Sliding Navigation List as label for Hierarchical Menu button.
See the translations attribute for usage examples.
- Default Value:
"Hierarchical Menu button"
- Since:
- 1.1.0
Names
Item Name Property translations.hierMenuBtnLabel -
(nullable) translations.previous-icon :string
-
Provides properties to customize the hover message text used by Sliding Navigation List for previous button.
See the translations attribute for usage examples.
- Default Value:
"Previous"
- Since:
- 1.1.0
Names
Item Name Property translations.previousIcon
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:
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. -
ojBeforeCollapse
-
Triggered before an item is collapse via the
expandedproperty, thecollapsemethod, or via the UI. To prevent the item being collapsed, invokeevent.preventDefault().Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information. -
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. -
ojBeforeExpand
-
Triggered before an item is expand via the
expandedproperty, theexpandmethod, or via the UI. To prevent the item being expanded, invokeevent.preventDefault().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. -
ojCollapse
-
Triggered after an item has been collapsed via the
expandedproperty, thecollapsemethod, or via the UI.Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information. -
ojExpand
-
Triggered after an item has been expanded via the
expandedproperty, theexpandmethod, or via the UI.Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.
Methods
-
getContextByNode(node) : {(oj.ojNavigationList.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.ojNavigationList.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 Navigation List. 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-navigation-list 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. keyany The Key of the item. dataany The data object for the item. parentElementElement The list item element. The renderer can use this to directly append content. depthnumber <optional>
the depth of the item parentKeyK <optional>
the key of the parent item leafboolean <optional>
whether the item is a leaf -
ItemTemplateContext
-
Properties:
Name Type Description componentElementElement The <oj-navigation-list> custom element dataObject The data for the current item being rendered indexnumber The zero-based index of the current item keyany The key of the current item being rendered depthnumber The depth of the current item (available when hierarchical data is provided) being rendered. The depth of the first level children under the invisible root is 1. leafboolean True if the current item is a leaf node (available when hierarchical data is provided). parentkeyany The key of the parent item (available when hierarchical data is provided). The parent key is null for root nodes. -
NodeContext<K>
-
Properties:
Name Type Argument 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. groupboolean whether the item is a group. parentElement <optional>
the parent group item. Only available if item has a parent.