Nextmatch
<et2-nextmatch> | Et2Nextmatch
Nextmatch shows entries with filtering and context menu
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>
Shared Template Details
Full details for columns, rows, expression syntax, wrapper behaviour, and loader slots are documented in:
Notes
-
If both a
templateattribute and slotted templates are provided,templatewins. -
setRows()can preload initial rows; otherwise rows are fetched through the bound Nextmatch data provider.
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
|
- | |
align
|
Used by Et2Box to determine alignment. Allowed values are left, right |
|
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. Mirrors
legacy extra_attributes setting.
|
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
|
- | |
lettersearch
|
Show A-Z letter search controls for filtering by leading character. Mirrors legacy
lettersearch nextmatch setting.
|
boolean
|
false
|
|
modifiedDateField
|
Field / column that holds Modified date for entries. Used for smart refresh. |
string
|
""
|
|
noLang
|
Disable any translations for the widget |
boolean
|
- | |
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[]
|
[]
|
|
searchletter
|
Current active letter search filter value.
false / empty means “all letters”.
|
string | false
|
false
|
|
statustext
|
Tooltip which is shown for this element on hover |
|
string
|
- |
styles
|
WebComponent * | - | - | |
template
|
Template name used to resolve columns and row layout. |
string
|
""
|
|
value
|
Legacy nextmatch value shape used by favorites and app state restore. |
Record
|
- | |
activeFilters
|
Legacy-compatible active filters accessor used by header/filter integrations.
Accessing filter state via this accessor is legacy compatibility. Prefer event-driven updates (`applyFilters`, header filter/sort events) and treat filter state as internal. |
Record
|
- | |
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 |
|---|---|---|---|
refresh |
EVENT NEEDS A DESCRIPTION |
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. | - | |
et2-selection-changed |
Re-emitted from the inner datagrid when row selection changes. | - | |
et2-columns-changed |
Re-emitted from the inner datagrid when columns change. | - |
Learn more about events.
Methods
| Name | Description | Arguments |
|---|---|---|
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 }
|
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. |
_parent: et2_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. |
_node: , _name:
|
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 |
- |
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 | - |
loadFromXML()
|
Loads the widget tree from an XML node |
_node:
|
loadingFinished()
|
Needed for legacy compatability. |
promises: Promise[]
|
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
|
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 | { key : string; title : string }>
|
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[]
|
sortBy()
|
Legacy-compatible sorting helper used by sort headers and filterbox. |
id: string, asc: boolean, update: boolean
|
_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 legacy sort preference persistence. | - |
_handleClick()
|
Click handler calling custom handler set via onclick attribute to this.onclick |
_ev: MouseEvent
|
_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 |
- |
getValue()
|
Legacy nextmatch state accessor used by favorites and app state restore.
Use value instead.
|
- |
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
|
Learn more about methods.
Custom Properties
| Name | Description | Default |
|---|---|---|
--row-height |
Forwarded to internal datagrid row-height estimate. | 3em |
--meta-column-width |
Width of leading metadata indicator column. | 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. |
footer |
Wrapper for bottom slot content rendered below the grid. |
Learn more about customizing CSS parts.