Usage
Signature:
interface CListViewElement<K extends string | number,D>
Typescript Import Format
//To typecheck the element APIs, import as below.
import { CListViewElement } from "oj-c/list-view";
//For the transpiled javascript to load the element's module, import as below
import "oj-c/list-view";
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.
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.
-
itemTemplate
-
The
itemTemplateslot is used to specify the template for rendering each item in the List. The slot content must be a <template> 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.
Properties of $current:
Name Type Description dataD The data of the item. Note this is made available primarily to ease migration. Applications should get the data from the item property instead. isTabbableboolean A boolean indicating whether the item is in tabbable mode or not. Template elements should not be tab-stops when the item is not in tabbable mode, this context can be used to implement conditional behavior for all tabbable child elements. itemItem.<K, D> Contains the data and metadata of the item. -
noData
-
The
noDataslot is used to specify the content to display when the list is empty. The slot content must be a <template> element. If not specified then a default no data message will be displayed.
Attributes
-
(readonly) current-item :any
-
The item that currently has keyboard focus
- 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 :(DataProvider.<K, D>|null)
-
The data source for ListView. Must be of type DataProvider.
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 -
gridlines :oj-c.ListView.Gridlines
-
Specifies whether the horizontal grid lines should be visible. By default gridlines are hidden. It takes the keys `item`, `top` and `bottom`, each of which are optional and take a value of "hidden" or "visible". `item` toggles the presence of bottom gridlines except the last item, and `top` and `bottom` toggle the initial and trailing gridlines. By default all gridlines are hidden.
Names
Item Name Property gridlinesProperty change event gridlinesChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-gridlines-changed -
scroll-policy-options :{ fetchSize?: number; scroller?: string }
-
scrollPolicy options.
The following options are supported:
- fetchSize: The number of items fetched each time when scroll to the end.
- scroller: The css selector that locates the element in which listview uses to determine the scroll position as well as the maximum scroll position where scroll to the end will trigger a fetch. If not specified then the root element of listview is used.
Names
Item Name Property scrollPolicyOptionsProperty change event scrollPolicyOptionsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-scroll-policy-options-changed -
scroll-policy-options.fetch-size :number
-
Names
Item Name Property scrollPolicyOptions.fetchSize -
scroll-policy-options.scroller :string
-
Names
Item Name Property scrollPolicyOptions.scroller -
selected :ImmutableKeySet.<K>
-
The current selected items in the ListView. An empty KeySet indicates nothing is selected. Note that property change event for the deprecated selection property will still be fire when selected property has changed. In addition, AllKeySetImpl set can be used to represent select all state. In this case, the value for selection would have an 'inverted' property set to true, and would contain the keys of the items that are not selected.
- Supports writeback:
true
Names
Item Name Property selectedProperty change event selectedChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selected-changed -
selection-mode :"multiple"|"none"|"single"
-
The type of selection behavior that is enabled on the ListView. This attribute controls the number of selections that can be made via selection gestures at any given time.
If
singleormultipleis specified, selection gestures will be enabled, and the ListView's selection styling will be applied to all items specified by the selection and selected attributes. Ifnoneis specified, selection gestures will be disabled, and the ListView's selection styling will not be applied to any items specified by the selection and selected attributes.Changing the value of this attribute will not affect the value of the selection or selected attributes.
- Default Value:
"none"
Supported Values:
Value Description multipleMultiple items can be selected at the same time. noneSelection is disabled. singleOnly a single item can be selected at a time. Names
Item Name Property selectionModeProperty change event selectionModeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-mode-changed
Events
-
ojItemAction
-
Triggered when user performs an action gesture on an item while ListView is in navigation mode. The action gestures include:
- User clicks anywhere in an item
- User taps anywhere in an item
- User pressed spacebar on an item
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type contextoj-c.ListView.ListItemContext
Methods
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description propertyThe 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 propertiesAn 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 corresponding event.
Parameters:
Name Type Description propertyThe property name to set. Supports dot notation for subproperty access. valueThe new value to set the property to. Returns:
- Type
- void
Type Definitions
-
Gridlines
-
Properties:
Name Type Argument bottom"hidden" | "visible" <optional>
item"hidden" | "visible" <optional>
top"hidden" | "visible" <optional>
-
ListItemContext<K,D>
-
Properties:
Name Type Description dataany The data of the item. Note this is made available primarily to ease migration. Applications should get the data from the item property instead. itemobject Contains the data and metadata of the item.