Skip to main content
Light Dark System

Nextmatch

<et2-nextmatch> | Et2Nextmatch

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.

Printing

When its page is printed, et2-nextmatch asks which columns, how many rows (up to 100 by default) and which page orientation to print, remembers the columns and orientation as the user’s print preference, and prints exactly those rows.

To always print a list the same way without asking, set printOptions from the app’s JS, eg. in et2_ready():

nm.printOptions = {columns: "all", rowCount: 100, orientation: "portrait"};
  • columns: "all" for every column the column selection offers (also ones the user has hidden), or the column keys to print, in that order.
  • rowCount: the maximum number of rows to print.
  • orientation: "portrait" or "landscape".

Options left out use the dialog’s defaults: the saved print columns (or the visible ones), up to 100 rows, portrait. Nothing is saved as print preference.

Row value bindings

Row templates bind in two ways, and the distinction is worth keeping straight:

  • An id gets you a value. id="title" is the widget’s stable id and names the row field it shows, so the datagrid supplies rowData.title as the widget value. This is the recommended form for row values.
  • $ and @ expressions set attributes and properties. They work in any row-template attribute, and each widget then applies its normal interpretation of the resolved value.

$field reads field from the current row and $[parent.child] reads a nested value. @field returns the content entry stored under that key, and @@field reads it from the root content instead of the current namespace.


<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>

value is an ordinary property, so an expression can set it like any other. Reach for that only when the value comes from a differently named or nested row field - when the id already names the field, it is redundant:


<et2-description id="summary" value="$[details.short]" noLang="1"></et2-description>

Keep action and compound ids as ids, for example id="delete[$id]"; they are not row-value bindings.

An id on a namespace-opening widget - a box, a grid, a nested nextmatch - scopes its children instead of naming a value of its own, so nested row data can be addressed by nesting the template. Given row data {id: 1, sub: {name: "cheese"}}:


<row>
    <et2-description id="id"></et2-description>
    <et2-vbox id="sub">
        <et2-description id="name"></et2-description>
    </et2-vbox>
</row>

the inner description binds sub.name. Whether an id scopes or binds is the widget’s own answer (_createNamespace()), the same question etemplate asks everywhere else - so an ordinary widget’s id still names a value even when the template nests markup inside it, and an unnamed container is pure layout that never affects the path. Flat row data stays flat no matter how deeply it is wrapped: {id: 1, name: "cheese"} still binds through <et2-vbox><et2-hbox><et2-description id="name"/></et2-hbox></et2-vbox>.

Attribute expressions are never namespaced: $field and ${row}[field] always address the row itself, wherever they are written.

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.

The application’s app.css is never loaded into the datagrid row shadow DOM, with or without et2-styles. A row template without et2-styles gets only the framework row styles.

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. app.css does not reach rows.

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.

Greying Out Inactive Entries

For an entry that is still listed but no longer in effect - a revoked application password, a deleted calendar event, a disabled policy - add the class rowInactive to the row. The framework row styles show it in a muted, italic font, the same in every app, so the app needs no CSS of its own for it.

if ($row['token_revoked'])
{
	// "revoked" stays for the actions' enableClass/disableClass, "rowInactive" greys the row out
	$row['class'] = 'revoked rowInactive';
}
<row class="$row_cont[class]">

Add rowInactive next to the app’s own class rather than replacing it, since actions and app code usually key on the app’s class.

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
activeFilters
Active filter snapshot used by header/filter integrations and action URL expansion. Use applyFilters() to update filter state. Record -
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 ""
autorefreshPreference Optional name for the autorefresh interval preference (nextmatch-<name>-autorefresh), default the row template’s. For a nextmatch that switches row templates, and with them its column preference, but should keep one interval - Mail’s vertical and horizontal layouts. string ""
columnPreferenceName
column-preference-name
Optional custom preference name for persisted datagrid column settings. 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
isLoading
True while rows are being fetched, so callers can avoid acting on row indexes that are about to change. boolean -
lazy Defer the initial row fetch until this nextmatch is actually being displayed, instead of loading immediately on connect. “Displayed” means nothing up the tree hides it - an inactive <et2-tab-panel> (which is display: none), an app view toggled off, a widget still carrying disabled/hidden - so an app that ships an empty list and shows it on demand never asks the server for rows nobody looks at. Only affects the client-side reload() fallback in firstUpdated() - template/column parsing and any server-preloaded rows/total are unaffected, so headers still render. That means an app using this must also stop its own server side from shipping rows ('num_rows' => 0), or the preloaded-rows branch runs and there is nothing left to defer. Has no effect on a nextmatch that is displayed straight away. boolean false
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 ""
onfiledrop
XET file-drop handler. Return false to cancel the framework’s default upload-and-link action ((rowUid : string, files : File[]) => unknown) | null null
order
Server-only. Name of the column to sort by initially, if the user has no stored sort preference yet and the app didn’t set one in PHP. Given directly on the widget in the template, eg. <nextmatch order="tr_modified" sort="DESC"/>. If omitted, falls back to the row_modified field (sorted newest first) when the app has one set. Read via $this->attrs['order'] in Nextmatch.php - not a reactive client property, has no effect once the widget is running in the browser. string | undefined -
placeholder Optional override for empty-state headline text. string ""
placeholderActions
Optional list of action ids allowed for placeholder context menu. string[] []
printOptions
Print with these options instead of showing the print dialog, eg. to always print a list the same way Options left out default to the dialog’s defaults: the saved print columns (or the visible ones), up to 100 rows, portrait. Nothing is saved as print preference. Et2NextmatchPrintOptions | null null
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 -
sort
Server-only. Direction (‘ASC’|‘DESC’) paired with order above. Defaults to ‘ASC’ if order is given without it. string | undefined -
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 -

Learn more about attributes and properties.

Inherited properties (21)

Et2Widget

Name Description
accesskey Accesskey provides a hint for generating a keyboard shortcut for the current element. The attribute value must consist of a single printable character.
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.
align Used by Et2Box to determine alignment. Allowed values are left, right
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.
data Set the dataset from a CSV
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.
dom_id Get the actual DOM ID, which has been prefixed to make sure it’s unique.
full Take every column of a layout, the same as span="all". Boolean rather than a bare marker so it can be driven from content the way the rest of the template can - full="@is_wide" resolves through the array manager like any other boolean attribute. That does mean it needs a value: write full="true", since an empty full="" resolves to false and removes the attribute again. Reflects for the same reason grow does.
grow How much of a layout’s leftover space this widget should take. Only means anything inside a container that has a layout (see Et2LayoutController): a bare grow or grow="1" takes an equal share of whatever the non-growing children left over, grow="2" takes twice what a grow="1" sibling does. It has to reflect. The layout stylesheet matches the [grow] attribute - CSS cannot see a property - and transformAttributes() only calls setAttribute() for an attribute the element already carries or a property declared as reflecting. Widgets built from a .xet are created with document.createElement() and handed their attributes as an object, so they carry none at that point: without this declaration grow="1" lands as an inert JS property and nothing in the layout ever matches it.
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.
id Get the ID of the widget
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
noLang Disable any translations for the widget
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
span How many of a layout’s columns this widget should take. span="all" is every column wherever the widget landed, span="end" / span="*" is from its own column to the end of its line. Only means anything inside a container that has a layout, and only for the column layouts - stack gives every child the full width anyway. The same name is also read straight off the XML node by the legacy <grid> widget, for the unrelated job of counting table cells to merge; that path never looks at the widget, so declaring it here does not disturb it. Reflecting it does mean a legacy grid’s span="all" cells now carry the attribute too, which matches nothing outside a layout. Reflects for the same reason grow does.
statustext Tooltip which is shown for this element on hover
styles WebComponent *
options Get property-values as object
supportedWidgetClasses et2_widget compatability

LitElement

Name Description
updateComplete A read-only promise that resolves when the component has finished updating.

Events

Name 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. Reentrancy: dispatching et2-filter below runs listeners (eg. Et2Filterbox) synchronously, which can update a filter widget’s .value to match the just-applied state - if that widget’s own value setter unconditionally re-fires a “change” event on a purely programmatic set (found live in Et2Date: flatpickr’s clear() defaults triggerChangeEvent to true, unlike setDate()), the bubbled “change” reaches Et2Filterbox’s own change handler, which calls back into this same method - before this call has returned. Without a guard, that’s an unbounded synchronous loop that freezes the tab (reproduced live via mail’s folder-filter date field, and reportedly also seen from filemanager’s nextmatch). The _applyingFilters guard breaks it at the very first reentry - other widgets could have the same one-sided trigger-on-clear bug we haven’t found yet. 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, unless printOptions presets them. 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. -
clearActiveRow() Forget the keyboard/pointer active row (the one drawn with a focus frame). A reload keeps the active row by id, which is right when the same query is refetched. When the caller switches to a different data set (eg. mail changing folder), call this right before applyFilters(), so the old id does not come back as a frame on a row that is not selected. The datagrid picks a new active row once the new rows arrive. -
clearSelection() Clear the displayed selection without exposing the action controller. -
collapseExpandedRows() Collapse all currently expanded child grids and forget their cached layout snapshots. -
executeAction() Execute a registered nextmatch action against the supplied or current selection. actionId: string, selection: { ids? : string[]; all? : boolean }, options: { nmAction? : string }
executeWithCompleteSelection() Run an action handler with every selected row as its senders. The grid only renders the rows in view, so the senders an action is triggered with are the rendered rows only. With “select all” or a shift range over rows that were never fetched, handlers working from their senders silently left out all the other rows. This fetches the missing ids first (fetchIdRange()), so no handler has to care. While ids have to be fetched, the user gets fetchIdRange()’s “Loading, please wait” dialog telling them why the action does not happen yet. Resolves without calling run if they cancel it. run: (senders : EgwActionObject[]) => any
fetchAllIds() Fetch matching ids up to the requested maximum, showing a cancelable wait dialog. pageSize: number, maxRows: number
fetchIdRange() Fetch the provider ids of count rows from row start on, behind a cancelable wait dialog. Rows the grid has fetched already are taken from it; only the gaps between them are requested, one page at a time. If there are no gaps, there is no request and no dialog. Rejects with an AbortError if the user cancels; no further page is requested then. start: number, count: number, pageSize: 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. -
getLoadedRowIds() Datastore row id for every row index, with null for indexes not currently loaded. Row content itself stays in egw’s UID cache (egw.dataGetUIDdata()); this is the index -> uid mapping needed to walk the result set in server order. -
getRowByNode() Find the row containing a DOM node, eg. the target of a click on a widget inside a row. Rows live in the datagrid’s shadow DOM and row widgets have shadow roots of their own, so neither closest() nor contains() gets there from an event target on its own - this walks the composed tree, through shadow hosts, up to this nextmatch. depth is 0 for a row of this nextmatch’s own grid and counts up for each level of expanded child grid the row sits in, so a caller can tell a top-level row from one in an expanded branch. node: Node | null
getSelection() Return the current selection tracked by the action controller. -
getValue() et2_IInput implementation used by eTemplate submit value collection. -
loadRowRange() Load rows start..end (inclusive) without moving the grid, resolving once they are available. For consumers that page through the result set independently of what the user has scrolled to, eg. filemanager’s image gallery. start: number, end: number
openColumnSelection() Open the column selection dialog from outside the datagrid header. event: Event
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
refreshColumnVisibility() Re-evaluate conditional column visibility against the current content. A row template can hide a column with an expression, eg. infolog’s <column disabled="@no_customfields"/>, and the server supplies the flag it reads among the non-numeric keys of the rows response. Those keys are written straight into the content array manager, which is not reactive, so the datagrid has to be told that the answer may have changed. -
selectionIncomplete() True if the action senders are not the complete selection: “select all” is active, a shift range holds rows that were not fetched, or the senders are a stale part of the selection - a context menu keeps the senders from when it was opened, and rows arriving later in a shift range join the selection after that. senders: { id : string }[]
setColumns() Public API to override visible columns programmatically. Accepts legacy string arrays and normalizes them for datagrid consumption. columns: Array<string | Et2DatagridColumn>
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
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. -
_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. -
set_columns() Legacy visible-column setter used by favorites and app state restore.
Use setColumns() instead.
column_list: string[], _trigger_update:
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.

Inherited methods (23)

Et2Widget

Name Description
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
clone() Creates a copy of this widget.
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.
getArrayMgr() Returns the array manager object for the given part
getArrayMgrs() Returns an associative array containing the top-most array managers.
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
getWidgetById() Extend the normal widget-tree lookup with the datagrid, e.g. header widgets built from the row template (like a sum in a column header) are Et2Datagrid’s children, not ours.
loadFromXML() Loads the widget tree from an XML node
loadingFinished() Needed for legacy compatability.
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.
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
setArrayMgr() Sets the array manager for the given part
setArrayMgrs() Sets all array manager objects - this function can be used to set the root array managers of the container object.
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
_createNamespace() Force namespace creation for nested widgets. Nextmatch behaves as a container and must always scope children.
_handleClick() Click handler calling custom handler set via onclick attribute to this.onclick
destroy() et2_widget compatability
set_class() Set the widget class
set_disabled() Wrapper on this.disabled because legacy had it.
set_statustext() supports legacy set_statustext

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. none
--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.

Belongs to

Nextmatch