OGE logoOGE

Data View API

Full surface of oge-data-view: its inputs and models, methods, outputs, the three structural template slots plus the toolbar attribute slot, and the config provider.

Properties Methods Events Types

OgeDataView

oge-data-view

Properties 25

Data

Name Type DefaultDescription
itemsreadonly T[][]The items in their own order. With remoteOperations: the current page.
keyExprOgeDataViewKeyExpr<T>'id'Field (dot paths allowed) or function giving each item’s key — the identity in selectedKeys and every event.
displayExprOgeDataViewDisplayExpr<T> | undefined—The text an item shows without a template; falls back to its title, name, text or label field.
remoteOperationsbooleanfalseThe app sorts, searches and pages: listen to optionsChanged, pass the page as items and the total as itemCount.
itemCountnumber | undefined—Total item count under remoteOperations; defaults to the processed items’ length.
loadingbooleanfalseMarks the items aria-busy; with nothing to show yet it draws skeleton tiles and a visually hidden “Loading…”.
localestring | undefinedconfig ?? LOCALE_IDBCP 47 locale of the sort comparison (numeric collation, so “Item 9” sorts before “Item 10”).
ariaLabelstring | undefined—Accessible name of the items; a listbox falls back to the dataView message.

Layout

Name Type DefaultDescription
layout'grid' | 'list' (model)config ?? 'grid'Responsive columns or one item per row — two-way.
showLayoutSwitchbooleanfalseRenders the grid / list toggle-button group (aria-pressed) in the header.
minItemWidthnumber | undefinedconfig ?? 240Narrowest grid cell in px before another column fits. Resolved by a container query on the view’s own inline size, never the window.
columnsnumber | undefined—A fixed column count for the grid layout; collapses to one column in a container under 480px.
gapnumber | string | undefined16pxGap between items — px number or any CSS length.

Paging

Name Type DefaultDescription
pageSizenumber | undefinedconfig ?? 0Items per page; 0 shows every item.
pageIndexnumber (model)00-based current page — two-way, clamped into the page range when rendered.
showPagerbooleantrueRenders the built-in pager when there is more than one page. Set it to false and bind an oge-pagination to [(pageIndex)] for the full bar (the layout package does not depend on navigation).
showPageInfobooleantrueRenders the {from}–{to} of {itemCount} text beside the pager.

Sorting, search & filtering

Name Type DefaultDescription
sortOptionsreadonly OgeDataViewSortOption[][]Choices of the built-in sort select (plus a direction toggle); empty hides both.
sortOgeDataViewSort | null (model)nullThe active sort — two-way. Text compares with the locale’s collator, numbers / dates / booleans numerically, empty values last.
filter((item: T) => boolean) | nullnullA predicate the items must pass (client-side only).
searchEnabledbooleanfalseRenders the search field in the header.
searchValuestring (model)''The search text — two-way. Every word must occur, compared case-, accent- and locale-insensitively.
searchExprOgeDataViewSearchExpr<T> | undefined—Field(s) or function the search matches; default every primitive field.

Selection

Name Type DefaultDescription
selectionMode'none' | 'single' | 'multiple''none'Selection turns the list into an APG listbox: one roving tab stop, arrows in reading order (mirrored in RTL), Up / Down by the measured column count, PageUp / PageDown turn the page, Space / Enter toggle, Ctrl+A selects all. Options are leaves, so the template must not hold controls.
selectedKeysreadonly OgeDataViewKey[] (model)[]Keys of the selected items — two-way.

Methods 5

Name Type Description
focus(index?)(index?: number) => voidFocuses the item at index of the page (default: the tab stop); without selection the first focusable control inside the items.
goToPage(index)(index: number) => voidShows page index (clamped) and emits pageChanged when it changed.
setLayout(layout)(layout: OgeDataViewLayout) => voidSwitches the layout and emits layoutChanged when it changed.
clearSelection()() => voidDeselects everything (emits selectionChanged).
selectAll()() => voidSelects every item that passes the filter and search — multiple selection only.

Events 11

Name Type Description
layoutChangeOgeDataViewLayoutThe banana half of [(layout)].
pageIndexChangenumberThe banana half of [(pageIndex)].
sortChangeOgeDataViewSort | nullThe banana half of [(sort)].
searchValueChangestringThe banana half of [(searchValue)].
selectedKeysChangereadonly OgeDataViewKey[]The banana half of [(selectedKeys)].
layoutChangedOgeDataViewLayoutChangedEventThe layout changed through the switch or setLayout().
pageChangedOgeDataViewPageChangedEventThe page changed through the pager, PageUp / PageDown or goToPage(); the new page is announced politely.
sortChangedOgeDataViewSortChangedEventThe sort changed through the built-in select or direction toggle (the page resets to 0).
selectionChangedOgeDataViewSelectionChangedEvent<T>The selection changed through a click, Space / Enter, Ctrl+A or a method.
itemClickOgeDataViewItemClickEvent<T>An item was clicked (or activated with Enter / Space in a listbox).
optionsChangedOgeDataViewOptionsChangedEventSort, search or page changed — the request to answer under remoteOperations.

Types 21

Slots

Name Type Description
OgeDataViewItemTemplate[ogeDataViewItemTemplate]Structural directive rendering each item in both layouts (non-interactive in a selectable view).
OgeDataViewListItemTemplate[ogeDataViewListItemTemplate]Renders each item in the list layout; falls back to the item template.
OgeDataViewEmptyTemplate[ogeDataViewEmptyTemplate]Replaces the empty state; $implicit says whether a search or filter caused it.
[ogeDataViewToolbar]attribute slotProjects your own controls into the header, before the built-in search, sort and layout switch.
OgeDataViewItemTemplateContext{ $implicit: T; index: number; layout: OgeDataViewLayout; selected: boolean }Context of the two item templates.
OgeDataViewEmptyTemplateContext{ $implicit: boolean; text: string }Context of the empty template.

Vocabulary

Name Type Description
OgeDataViewLayout'grid' | 'list'Responsive columns, or one item per row.
OgeDataViewSelectionMode'none' | 'single' | 'multiple'none renders a list; single / multiple an APG listbox.
OgeDataViewKeystring | numberAn item identity, from keyExpr.
OgeDataViewKeyExprstring | ((item: T) => OgeDataViewKey)Field (dot paths allowed) or function; an item without a usable key falls back to its index.
OgeDataViewDisplayExprstring | ((item: T) => string)Where the fallback text of a template-less item comes from.
OgeDataViewSearchExprstring | readonly string[] | ((item: T) => string)The text the search matches.
OgeDataViewSort{ field: string; direction: 'asc' | 'desc' }The active sort.
OgeDataViewSortDirection'asc' | 'desc'Direction of a sort.
OgeDataViewSortOption{ field: string; label: string }One choice of the built-in sort select.
OgeDataViewLayoutChangedEvent{ layout; previousLayout; event? }Payload of the layout change.
OgeDataViewPageChangedEvent{ pageIndex; previousPageIndex; pageSize; event? }Payload of the page change (0-based pages).
OgeDataViewSortChangedEvent{ sort: OgeDataViewSort | null; previousSort; event? }Payload of the sort change.
OgeDataViewSelectionChangedEvent{ selectedKeys; previousKeys; item?; event? }Payload of the selection change; item is absent for Ctrl+A and the methods.
OgeDataViewItemClickEvent{ item: T; index; key; event }Payload of an item click / activation.
OgeDataViewOptionsChangedEvent{ sort; searchValue; pageIndex; pageSize }The request a remoteOperations app answers with the next page.

Configuration

Properties 2

Name Type Description
provideOgeDataViewConfig(config)(config: OgeDataViewConfigInput | (() => OgeDataViewConfigInput)) => ProviderApplication- or component-scoped defaults for layout, pageSize, minItemWidth, locale and the messages (a function makes it live).
OGE_DATA_VIEW_CONFIGInjectionToken<OgeDataViewConfig>The token behind provideOgeDataViewConfig(), with OGE_DEFAULT_DATA_VIEW_CONFIG as its factory default.

Types 5

Name Type Description
OgeDataViewConfiginterfaceThe resolved config (messages, layout?, pageSize?, minItemWidth?, locale?).
OgeDataViewConfigInputinterfaceThe partial input both providers accept (messages merged one level deep).
OGE_DEFAULT_DATA_VIEW_CONFIGOgeDataViewConfigThe resolved defaults.
OgeDataViewMessagesinterfaceEvery user-facing string, aria labels included: dataView, layoutSwitch, gridLayout, listLayout, sortBy, sortNone, ascending, descending, search, searchPlaceholder, pager, previousPage, nextPage, page ({page}), pageInfo ({from} {to} {itemCount}), pageAnnouncement, noData, noResults, results (ICU plural over {count}) and loading. Translated in every @oge-ui/locales pack (layout.dataView).
OGE_DEFAULT_DATA_VIEW_MESSAGESOgeDataViewMessagesThe English catalog.