Skip to main content
Light Dark System

Nextmatch Auto Refresh

Et2NextmatchAutoRefresh Controller

Overview

Background autorefresh poll for an Et2Nextmatch instance, for apps/instances without reliable push notifications.

Each tick is a full reload (one ajax_get_rows request, via the host’s own refresh()), not a per-row update. Apps that always have push disable autorefresh outright (the disable_autorefresh setting) rather than relying on this.

The interval is read from a per-instance user preference (nextmatch-<preferenceBase>-autorefresh, seconds; 0/absent = off), editable from the column-selection dialog’s autoRefresh field via seedColumnSelection()/applyColumnSelection().

The timer pauses whenever this nextmatch isn’t actually visible, checked live rather than tracked as a toggled flag: it must be rendered, its EGroupware app tab (if any) must be the active one, and the browser tab/window itself must not be backgrounded. Resuming does one immediate refresh, since the data may be stale, then resumes the regular interval.

Used by

These widgets create and host this controller.

Methods

Name Description Arguments
applyColumnSelection() Persist a changed autoRefresh value from the column-selection dialog result (the et2-column-selection-apply event’s values object) and restart the timer against it. Always stores the literal value, including 0 for “off” - unsetting the preference instead would fall through to any admin-configured default and silently undo the user’s choice. Also contributes this interval’s own preference key/value into adminPrefs (unconditionally - whether it’s actually used is Et2Datagrid’s call, based on whether the admin picked anything from default_preference), the bucket bundled into one admin save-as-default/force/reset action alongside the column selection itself. values: Record<string, any> | undefined, adminPrefs: Record<string, any>
hostConnected() Attach visibility listeners. Called by Lit when the host connects. -
hostDisconnected() Detach everything. Called by Lit when the host disconnects. -
restart() Called after a (re)load completes, and after the user changes the autorefresh interval from column selection - re-derives everything from current state rather than trying to patch the running timer. -
seedColumnSelection() Seed the column-selection dialog’s autoRefresh field with the current value, via the et2-column-selection-items event’s content object. Apps that opted out via disable_autorefresh have nothing to configure here, so the field is hidden via modifications instead of shown disabled (legacy’s dialog grayed it out, but there’s no reason to show admins a dead control) - either way, a submitted value must not be silently accepted and dropped. The admin-only default_preference select (“set as default”/“reset”/“force”) saves the autorefresh interval as part of the same action (Et2Datagrid._maybeSaveColumnSelectionAsAdminDefault() / Nextmatch::ajax_set_admin_default()), so it’s hidden right along with autoRefresh - there’d be nothing meaningful for it to save for these apps either. content: Record<string, any>, modifications: Record<string, any>