Skip to main content
Light Dark System

Nextmatch

<et2-nextmatch> | Et2Nextmatch
Since 23.1

Nextmatch shows entries with filtering and context menus. Et2Nextmatch uses Et2Datagrid to show application entries using a row template. Rows must be read-only, we do not allow inputs in the rows.

Overview

Named Template Mode

Use the template attribute when you already have a classic eTemplate rows template:

<et2-nextmatch id="nm" template="addressbook.index.rows"></et2-nextmatch>

The row/header structure is read from that template and converted for et2-datagrid.

Slotted Template Mode

(WIP) When template is not set, et2-nextmatch reads slotted child markup from its light DOM.

<et2-nextmatch id="nm">
    <et2-box slot="header">Custom toolbar / filters / actions above grid</et2-box>

    <tr class="th" slot="columns">
        <et2-nextmatch-sortheader id="n_family" label="Name"></et2-nextmatch-sortheader>
        <et2-nextmatch-header id="note" label="Note"></et2-nextmatch-header>
    </tr>

    <tr class="$class $cat_id" slot="row">
        <et2-description id="n_family" noLang="1"></et2-description>
        <et2-textarea id="note" readonly="true" noLang="1"></et2-textarea>
    </tr>

    <tr slot="loader">
        <td colspan="2">
            <sl-skeleton effect="sheen" style="width:100%"></sl-skeleton>
        </td>
    </tr>
</et2-nextmatch>

Full details for columns, rows, expression syntax, wrapper behaviour, and loader slots are documented in:

Row expansion

et2-nextmatch maps the existing Nextmatch hierarchy contract onto et2-datagrid row expansion. There is no separate client or server contract for recursive expansion:

  • rows are expandable when the row data has is_parent: true, or when the configured settings.is_parent field matches settings.is_parent_value;
  • child rows are fetched through the existing child-provider path, which sends parent_id to the server;
  • every child level uses the same expansion semantics as its parent; only the parent_id scoped to that level changes.

Expanded content is an embedded <et2-datagrid> that reuses the parent Nextmatch row template, column snapshot, row customizer, and row styles. The child grid is embedded-virtualized, so it does not create a nested scrollbar. It reserves its own full virtualized height inside the parent scrollport while rendering only the visible child rows.

Expansion is recursive for acyclic hierarchy data. If a child row is marked as a parent by the same is_parent / configured marker contract, that child row can expand into another embedded datagrid using the same contract. Each level keeps its own total; child totals are not rolled up into the root total.

The server must not return cyclic hierarchy data such as A → B → A or a row as its own child. Recursive expansion documents this as a data requirement; it does not add a runtime cycle/depth guard.

Notes

  • If both a template attribute and slotted templates are provided, template wins.
  • setRows() can preload initial rows; otherwise rows are fetched through the bound Nextmatch data provider.

Row value bindings

Use direct row bindings in new or edited row templates. $field reads field from the current row; $[parent.child] reads a nested value. Direct bindings work in any row-template attribute; each widget then applies its normal interpretation of the resolved attribute value.


<row class="$class $[category.css_class]">
    <et2-description id="title" noLang="1"></et2-description>
    <et2-date-time id="modified" readonly="true"></et2-date-time>
    <et2-image src="$icon" label="$type_label"></et2-image>
    <et2-description class="priority_$priority" id="status" noLang="1"></et2-description>
</row>

For ordinary display widgets, id="title" remains the stable widget id and, when the row has an own title field, the datagrid supplies rowData.title as the widget value. Use value="$other_field" when the value comes from a differently named or nested row field. Keep action and compound ids as ids, for example id="delete[$id]"; they are not row-value bindings.

Existing templates do not need a bulk rewrite. Legacy ${row}[title], {$row}[title], $row_cont[title], and $row.title continue to work in row templates. Use them only when documenting or maintaining legacy markup; new examples and template edits should use direct bindings.

Styling Rows

et2-nextmatch renders rows inside et2-datagrid, so normal application CSS does not automatically reach row contents. Put row-specific styles in an et2-styles element inside the row template definition. et2-nextmatch extracts those styles and adopts them into the datagrid row shadow DOM.


<template id="app.index.rows">
    <grid>
        ...
    </grid>

    <et2-styles src="row.css"></et2-styles>
</template>

The et2-styles element can be anywhere inside the row template definition, not only inside <row>. Bare filenames such as row.css resolve relative to the .xet file containing the template.

When row-template-local styles are present, the current application’s templates/default/app.css is not loaded into the datagrid row shadow DOM. If the row template does not contain et2-styles, app.css is still loaded as a compatibility fallback.

Row-template-local stylesheets have these advantages:

  • fewer unrelated app rules inside row shadow DOM
  • clearer ownership for styles used only by one row template
  • smaller stylesheet parse cost for large app.css files
  • fewer accidental matches between edit/view CSS and list rows
  • easier deletion when a row template is removed or replaced

For the full set of row styling options, including exportparts, see Et2Datagrid: Styling Row Contents.

Anti-example: Styling Row Descendants Through ::part(row)

Do not try to style widgets inside rows from outside the datagrid shadow DOM by selecting descendants of the exported row part. ::part() exposes the part element itself, not arbitrary descendants inside that part, so this selector will not style row links:

et2-nextmatch {
  ::part(row) {
	/* Links in nextmatch should be blue */

	et2-link, et2-link-string {
	  color: var(--sl-color-sky-900);
	}
  }
}

Because the rows are managed by et2-datagrid inside its shadow DOM, you cannot style them from outside the datagrid.

  • et2-nextmatch::part(row) { ... } can style the row elements themselves, but not their descendants.
  • et2-nextmatch::part(row) et2-link { ... } cannot style links inside the row.
  • et2-nextmatch::part(exported-part) { ... } can style explicitly exported parts.

For framework-level row styles, add to Et2Nextmatch.row.styles.ts. For app-specific row styles, use the app’s row-template et2-styles. templates/default/app.css remains the fallback for row templates that have not been migrated.

For application rules generated at runtime, create a constructable stylesheet and add it through the nextmatch:

const style = new CSSStyleSheet();
style.replaceSync("tr.dynamic-state { color: var(--dynamic-color); }");
nextmatch.addRowStylesheet(style);

The stylesheet is adopted after the static row styles and is retained if the row template is reloaded.

Highlighting an Overdue Entry

Have the server add an overdue class for rows that need attention, then style that class via CSS.


<row class="$class">
    <et2-description class="task-title" id="title" noLang="1"></et2-description>
    <et2-description class="task-due" id="due" noLang="1"></et2-description>
</row>
.overdue .task-title {
	font-weight: var(--sl-font-weight-semibold);
}

.overdue .task-due {
	color: var(--sl-color-danger-700);
}

Letting Users Show Or Hide Row Details

For a list option such as “show details”, set a CSS custom property on the nextmatch widget when the option changes. The row stylesheet can then use that value for every row, including rows that are rendered later while scrolling.

show_details(show, nextmatch : Et2Nextmatch)
{
	nextmatch?.style?.setProperty("--task-details-display", show ? "block" : "none");
}
<row class="$class">
    <et2-description class="task-title" id="title" noLang="1"></et2-description>
    <et2-description class="task-details" id="description" noLang="1"></et2-description>
</row>
.task-details {
	display: var(--task-details-display, none);
	max-height: 5em;
	overflow: clip;
}

This is the same pattern InfoLog uses to show or hide description rows without updating each row individually.

Wrapping Contact Details

If the row contains a widget with internal layout, expose the part you need and style it from CSS.


<row class="$class">
    <et2-hbox class="contact-methods" exportparts="base:contact-methods__base">
        <et2-url-phone id="tel_work" readonly="true"></et2-url-phone>
        <et2-url-phone id="tel_cell" readonly="true"></et2-url-phone>
        <et2-url-email id="email" readonly="true"></et2-url-email>
    </et2-hbox>
</row>
et2-nextmatch::part(contact-methods__base) {
	flex-wrap: wrap;
	row-gap: var(--sl-spacing-2x-small);
}

Slots

Name Description
header Optional content rendered above the datagrid.
footer Optional content rendered below the datagrid.
columns Slotted column definition used to derive datagrid columns when template is not set.
row Slotted row template used to render each datagrid row when template is not set.
loader Optional slotted loader content shown while rows are loading.
noResults Optional slotted empty-state content replacing default no-results alert.

Learn more about using slots.

Properties

Name Description Reflects Type Default
accesskey Accesskey provides a hint for generating a keyboard shortcut for the current element. The attribute value must consist of a single printable character. string -
actions Set Actions on the widget Each action is defined as an object: move: { type: “drop”, acceptedTypes: “mail”, icon: “move”, caption: “Move to” onExecute: javascript:mail_move” } This will turn the widget into a drop target for “mail” drag types. When “mail” drag types are dropped, the global function mail_move(egwAction action, egwActionObject sender) will be called. The ID of the dragged “mail” will be in sender.id, some information about the sender will be in sender.context. The etemplate2 widget involved can typically be found in action.parent.data.widget, so your handler can operate in the widget context easily. The location varies depending on your action though. It might be action.parent.parent.data.widget To customise how the actions are handled for a particular widget, override _link_actions(). It handles the more widget-specific parts. object -
activeFilters
Active filter snapshot used by header/filter integrations and action URL expansion. Use applyFilters() to update filter state. Record -
align Used by Et2Box to determine alignment. Allowed values are left, right string -
appName
app
App that owns this nextmatch’s rows - used for sort/refresh/lettersearch preference persistence, row-stylesheet loading and legacy action-manager registration (see _getAppName()). Set this explicitly when a nextmatch is embedded in another app’s page (eg. InfoLog’s CRM view inside addressbook) and the owning app can’t be inferred from template. Leave unset to fall back to _getAppName()’s own resolution. string ""
class CSS Class. This class is applied to the outside, on the web component itself. Due to how WebComponents work, this might not change anything inside the component. string -
columnPreferenceName
column-preference-name
Optional custom preference name for persisted datagrid column settings. string ""
data Set the dataset from a CSV string -
deferredProperties
Any attribute that refers to row content cannot be resolved immediately, but some like booleans cannot stay a string because it’s a boolean attribute. We store them for later, and parse when they’re fully in their row. If you are creating a widget that can go in a nextmatch row, and it has boolean attributes that can change for each row, add those attributes into deferredProperties - -
disabled Defines whether this widget is visibly disabled. The widget is still visible, but clearly cannot be interacted with. Widgets disabled in the template will not return a value to the application code, even if re-enabled via javascript before submitting. To allow a disabled widget to be re-enabled and return a value, disable via javascript in the app’s et2_ready() instead of an attribute in the template file. boolean false
dom_id
Get the actual DOM ID, which has been prefixed to make sure it’s unique. string -
extraAttributes
Optional list of custom filter attributes that should round-trip through nextmatch fetches. string[] []
filterTemplate
Optional filter template source (template name, .xet URL, or template element). string | Et2Template | HTMLElement | null null
hidden The widget is not visible. As far as the user is concerned, the widget does not exist. Widgets hidden with an attribute in the template may not be created in the DOM, and will not return a value. Widgets can be hidden after creation, and they may return a value if hidden this way. boolean -
id
Get the ID of the widget string -
label The label of the widget This is usually displayed in some way. It’s also important for accessability. This is defined in the parent somewhere, and re-defining it causes labels to disappear string -
legacyOnselect
Legacy XET selection handler. This intentionally does not use the DOM onselect property, whose native Event callback signature conflicts with nextmatch’s legacy (selectedRowIds, nextmatch) contract. ((selectedRowIds : string[], nextmatch : Et2Nextmatch) => unknown) | null null
lettersearch Show A-Z letter search controls for filtering by leading character. Users can still turn it off in column selection preferences boolean false
modifiedDateField
Field / column that holds Modified date for entries. Used for smart refresh. string ""
noLang Disable any translations for the widget boolean -
onfiledrop
XET file-drop handler. Return false to cancel the framework’s default upload-and-link action ((rowUid : string, files : File[]) => unknown) | null null
parentId Parent is different than what is specified in the template / hierarchy. Widget ID of another node to insert this node into instead of the normal location string -
placeholder Optional override for empty-state headline text. string ""
placeholderActions
Optional list of action ids allowed for placeholder context menu. string[] []
rows Initial rows data. Can be set directly or via setRows(). any[] []
settings
Additional nextmatch settings Additional customized settings for applications that can’t follow the defaults. Keep this available for action handlers that still use nextmatch..settings, especially the server-defined action variable used by submit actions. Record -
statustext Tooltip which is shown for this element on hover string -
styles
WebComponent * - -
template Template name used to resolve columns and row layout. This uses a custom accessor instead of Lit’s generated setter so template changes can mark configuration loading synchronously before the next render. Without that early flag, the child datagrid can render once with no template data and log a false missing-template warning during initial load. string -
totalCount
Get the total number of rows number -
value
Nextmatch value used by submits, favourites, and app state. Record -
view Visual layout mode for the inner datagrid. Row is the default. Et2DatagridView -
options
Get property-values as object
use widget methods
object -
supportedWidgetClasses
et2_widget compatability
Legacy compatability. Some legacy widgets check their parent to see whats allowed
array []
updateComplete A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties.

Events

Name React Event Description Event Detail
et2-columns-changed Re-emitted from the inner datagrid when columns change. CustomEvent<{columns: Et2DatagridColumn[]}>
refresh Legacy compatibility event emitted after refresh requests are processed. CustomEvent
et2-loading-start Re-emitted from the inner datagrid when row fetching starts. -
et2-loading-done Re-emitted from the inner datagrid when all fetches complete. -
et2-loading-error Re-emitted from the inner datagrid when a fetch fails. -
et2-search-result Legacy-compatible event emitted after fetch completion. CustomEvent<{total: string, nextmatch: Et2Nextmatch}>
et2-selection-changed Re-emitted from the inner datagrid when row selection changes. CustomEvent<{selectedRowIds?: string[], activeRowId?: string, allSelected?: boolean, replaceSelection?: boolean}>
et2-active-row-changed Re-emitted from the inner datagrid when active row focus changes. CustomEvent<{activeRowId?: string, activeRowIndex?: number}>
et2-filter Cancelable event emitted before active filters are applied. CustomEvent<{oldFilters: Record<string, any>, activeFilters: Record<string, any>, nm: Et2Nextmatch}>
et2-filedrop Native OS file drop onto a row (or empty area). rowUid is ”″ when dropped outside any row. Cancelable: call event.preventDefault() in a listener to suppress the framework default (upload + link into the row’s VFS link dir) and handle it yourself (e.g. filemanager uploads into the row’s folder). CustomEvent<{rowUid: string, files: File[]}>
et2-rows-deleted Emitted after displayed rows are deleted. The neighbour ids are captured before deletion for application-specific selection policy. CustomEvent<{rowIds: string[], previousRowId: string|null, nextRowId: string|null}>

Learn more about events.

Methods

Name Description Arguments
addRowStylesheet() Adopt an additional runtime stylesheet into the main and child datagrid row shadow roots. The stylesheet is retained when template row styles are synchronized again. style: CSSStyleSheet
afterPrint() Restore normal columns and virtualized rendering after browser printing. -
applyFilters() Legacy-compatible filter application entry point. Merges updates into activeFilters, emits cancelable et2-filter, and reloads rows by default. set: Record<string, any>, options: { reload? : boolean, clearActions? : boolean }
beforePrint() Prepare the current nextmatch for browser printing. The existing XET dialog supplies print-only columns, row count, and page orientation. Column/orientation choices default from _printPreferenceKey (falling back to legacy Nextmatch’s <pref>_print/<pref>_print_orientation preferences if that’s all that exists), and are saved back only to _printPreferenceKey - see that getter for why the legacy keys are never written. -
checkCreateNamespace() Checks whether a namespace exists for this element in the content array. If yes, an own perspective of the content array is created. If not, the parent content manager is used. Constructor attributes are passed in case a child needs to make decisions -
clearSelection() Clear the displayed selection without exposing the action controller. -
clone() Creates a copy of this widget. _parent: et2_widget
collapseExpandedRows() Collapse all currently expanded child grids and forget their cached layout snapshots. -
createElementFromNode() Create a et2_widget from an XML node. First the type and attributes are read from the node. Then the readonly & modifications arrays are checked for changes specific to the loaded data. Then the appropriate constructor is called. After the constructor returns, the widget has a chance to further initialize itself from the XML node when the widget’s loadFromXML() method is called with the node. _node: , _name:
executeAction() Execute a registered nextmatch action against the supplied or current selection. actionId: string, selection: { ids? : string[]; all? : boolean }, options: { nmAction? : string }
fetchAllIds() Fetch matching ids up to the requested maximum, showing a cancelable wait dialog. pageSize: number, maxRows: number
findActionTarget() Expose row-target resolution to the legacy action framework’s AOI bridge. event: Event
focusRowById() Focus a displayed row and scroll it into view. rowId: string
getActiveRowId() Id of whichever row - in the parent grid or an expanded child grid - keyboard/pointer navigation currently considers active. _syncActiveGrid guarantees at most one grid has a non-null active row at a time, so the first match found is authoritative. -
getArrayMgr() Returns the array manager object for the given part managed_array_type: string
getArrayMgrs() Returns an associative array containing the top-most array managers. _mgrs: object
getChildren() Get child widgets Use .children to get web component children -
getInstanceManager() Returns the instance manager -
getPath() Returns the path into the data array. By default, array manager takes care of this, but some extensions need to override this -
getRoot() Returns the base widget Usually this is the same as getInstanceManager().widgetContainer -
getSelection() Return the current selection tracked by the action controller. -
getValue() et2_IInput implementation used by eTemplate submit value collection. -
loadFromXML() Loads the widget tree from an XML node _node:
loadingFinished() Needed for legacy compatability. promises: Promise[]
openColumnSelection() Open the column selection dialog from outside the datagrid header. event: Event
parseXMLAttrs() The parseXMLAttrs function takes an XML DOM attributes object and adds the given attributes to the _target associative array. This function also parses the legacyOptions. N.B. This is only used for legacy widgets. WebComponents use transformAttributes() and do their own handling of attributes. _attrsObj: , _target: object, _proto: et2_widget
refresh() Refresh given rows for specified change Change type parameters allows for quicker refresh then complete server side reload: - update: request modified data from given rows. May be moved. - update-in-place: update row, but do NOT move it, or refresh if uid does not exist - edit: rows changed, but sorting may be affected. Full reload. - delete: just delete the given rows clientside (no server interaction neccessary) - add: put the new row in at the top, unless app says otherwise What actually happens also depends on a general preference “lazy-update”: default/lazy: - add always on top - updates on top, if sorted by last modified, otherwise update-in-place - update-in-place is always in place! exact: - add and update on top if sorted by last modified, otherwise full refresh - update-in-place is always in place! Nextmatch checks the application callback nm_refresh_index, which has a default implementation in egw_app.nm_refresh_index(). _row_ids: string[]|string, _type: ?string
refreshChildRows() Refresh rows in an expanded child grid without refreshing the root grid. parentRowId: string, rowIds: string[] | string, type: Et2DatagridUpdateType
set_label() NOT the setter, since we cannot add to the DOM before connectedCallback() TODO: This is not best practice. Should just set property, DOM modification should be done in render https://lit-element.polymer-project.org/guide/templates#design-a-performant-template value: string
setArrayMgr() Sets the array manager for the given part _part: string, _mgr: object
setArrayMgrs() Sets all array manager objects - this function can be used to set the root array managers of the container object. _mgrs: object
setColumns() Public API to override visible columns programmatically. Accepts legacy string arrays and normalizes them for datagrid consumption. columns: Array<string | Et2DatagridColumn>
setInstanceManager() Set the instance manager Normally this is not needed as it’s set on the top-level container, and we just return that reference manager: etemplate2
setRows() Public API to inject already-fetched rows. This bypasses first server fetch and is used for fast preloaded lists. rows: any[]
setView() Switch between row and tile layout. view: Et2DatagridView, templateName: string
sortBy() Legacy-compatible sorting helper used by sort headers and filterbox. id: string, asc: boolean, update: boolean
updateRowData() Apply already-known-fresh data to one loaded row and re-render it, without a server round-trip - eg. for an optimistic UI update that might be overwritten later on with an actual refresh() rowId: string, data: any
whenColumnsReady() Resolves once the template columns have been derived, so consumers (e.g. filemanager tile view) can await visible columns without polling: await nm.whenColumnsReady(); // getValue().selectcols is now populated This is a side-channel promise, independent of updateComplete, so awaiting it never blocks or stalls etemplate2’s load. -
_createNamespace() Force namespace creation for nested widgets. Nextmatch behaves as a container and must always scope children. -
_get_action_links() Get all action-links / id’s of 1.-level actions from a given action object This can be overwritten to not allow all actions, by not returning them here. actions:
_getAppName() Resolve app-name used for sort preference persistence. Preference order: the explicit appName property, then the app that owns this nextmatch’s rows (the first segment of template, eg. “infolog” from “infolog.index.rows”), then the instance manager’s app as a last resort. Server-side, the preference is always read back under the app resolved from get_rows (Nextmatch.php: explode('.', $value['get_rows'])[0]), which is the same owning app - not necessarily the surrounding page/tab’s app. Views that embed one app’s nextmatch inside another (eg. InfoLog’s CRM view inside addressbook, which forces currentapp to “addressbook”) would otherwise save the sort preference under the wrong namespace and never see it applied again. Set appName explicitly for cases where template doesn’t carry the owning app as its first segment. -
_handleClick() Click handler calling custom handler set via onclick attribute to this.onclick _ev: MouseEvent
_initActions() Initialize legacy nextmatch actions through the action controller. actions: EgwAction[] | { [id : string] : object }
_link_actions() Link the actions to the DOM nodes / widget bits. actions: object
_set_label() Do some fancy stuff on the label, splitting it up if there’s a %s in it Normally called from updated(), the “normal” setter stuff has already been run before this is called. We only override our special cases (%s) because the normal label has been set by the parent value: string
destroy() et2_widget compatability
true
-
set_class() Set the widget class
Use this.class or this.classList instead
new_class: string
set_columns() Legacy visible-column setter used by favorites and app state restore.
Use setColumns() instead.
column_list: string[], _trigger_update:
set_disabled() Wrapper on this.disabled because legacy had it.
Use widget.disabled for visually disabled, widget.hidden for visually hidden. Disabled vs Readonly vs Hidden
value: boolean
set_statustext() supports legacy set_statustext
use this.statustext
value: string
set_template() Change the row template
Set .template instead, wait for updateComplete
template_name: string
set_view() Switch between row and tile layout.
Use setView() instead.
view: Et2DatagridView

Learn more about methods.

Custom Properties

Name Description Default
--row-height Forwarded to internal datagrid row-height estimate. 3em
--row-cell-max-height Forwarded to internal datagrid row cell max height. 10em
--meta-column-width Width of leading metadata indicator/expander column. max(var(–sl-spacing-large), 6px)

Learn more about customizing CSS custom properties.

Parts

Name Description
header Wrapper for top header slot content rendered above the grid.
grid Internal et2-datagrid element.
subgrid Expanded child et2-datagrid rendered for expandable rows.
footer Wrapper for bottom slot content rendered below the grid.

Learn more about customizing CSS parts.