Lattice Grid Buy a licence

developer guide

JavaScript Data Grid Events API

Every notable thing the grid does is announced as an event, so your application can follow a selection, an edit, a sort or a filter without polling for it. The before-events go further: they hand you the action while it can still be stopped, so a rule of yours can refuse it and give the reason.

Developer guide › JavaScript Data Grid Events API

Events

One bus, 111 events. The table below is the working set, the ones most applications actually reach for; a complete index by area follows it, and the reference lists them all.

EventCarriesUse it for
ready{}First render is done. Fires on a future turn, so you can subscribe on the line after createGrid.
cell:changed{ row, key, colId, value, oldValue, undo }Persisting an edit. undo distinguishes a rollback from a fresh change.
selection:changed{ keys }Enabling a bulk action.
range:changed{ ranges }A status bar showing the sum of what is selected: see selection.summary().
sort:changed / filter:changed{ sort } / { filters }Reflecting the view in the URL.
history:changed{ canUndo, canRedo, undo, redo }Driving your own undo button. Emitted after the entry is pushed, so the label is right.
history:applied{ direction, step }An action was undone or redone, with which and what. history:changed also fires when a new action is pushed, so it cannot distinguish the two.
form:saved{ key, values, changed, unmapped }Persisting a row edited on a form. unmapped names the fields that are not columns, which the grid reports rather than writes.
form:error{ key, error, timedOut }A row form's load failed or ran out of time. The panel stays open with a retry.
view:saved / :removed{ view, views }Persisting saved views to a server.
render:done{ first, last }Decorating cells from outside. The cell layer rewrites class names on every paint, so anything added before this is erased.

Every event, by area

The table above is the working set. This is the whole list, grouped by what it is about, so a question like "can I hear about a column being pinned?" is answerable by scanning rather than by reading the reference end to end.

Lifecycle

EventFires when
config:changedA configuration key changed. Emitted after the grid has rebuilt, so a listener reading the grid back sees the change rather than what it replaced.
destroygrid.destroy() has run.
licence:changedA key was installed, and again when verification settles.
readyFirst layout is complete and the API is safe to drive.
render:doneThe cells are written and stable. Anything decorating them from outside must run after this, the cell layer rewrites each cell's className wholesale and would otherwise erase it.
render:firstFirst paint, the number to measure time-to-first-row against.

Data

EventFires when
model:changedColumns, grouping, pivot or another structural change.
row:clickedEmitted alongside the cell event, cell first.
row:copiedA row was duplicated.
row:dblclickedA row was double-clicked. Emitted alongside the cell event, cell first.
row:edit:endIn row mode an invalid cell blocks the whole commit and the session stays open.
row:edit:startReplaces the cell pair when edit.mode is 'row'.
row:movedA row was dragged to a new position.
row:receivedA row arrived from a source.
row:sentA row was written back to a source.
rowDrag:startedA row drag began. Fires on the grid the drag started in, as do rowDrag:moved, rowDrag:left and rowDrag:ended.
rowDrag:movedThe drag is over a candidate position. Coalesced to one event per animation frame, carrying that frame's latest pointer position.
rowDrag:leftThe pointer left a grid; over names the grid it left. Emitted on the transition, not on a frame.
rowDrag:endedThe gesture ended, whether or not a drop followed, including a release outside every grid. dropped says whether the release is being acted on. Notifications only - none of the four is cancellable.
rows:changedThe row set changed. See what a change firing promises: identified means the three arrays name the rows that moved, companion marks a duplicate announcement of a change already made with identity, and a firing with neither is a real change of unknown extent.
rows:deferredUpdates were held rather than applied, because an edit is in flight.
rows:pausedA live feed was paused; updates queue from here.
rows:queuedA batched change is waiting for the next frame.
rows:resumedThe feed resumed and the queue drained.
source:errorA source or block load failed.
stream:chunkA streamed chunk landed.
stream:endStreaming finished; promoted means it switched to in-memory.
stream:evictedA streaming source dropped rows to stay within its cap.

Cells and editing

EventFires when
cell:changedA committed edit reached the data. undo distinguishes a rollback.
cell:clickedA cell was clicked. Announcement only: nothing is consumed, so editing and selection behave unchanged.
cell:confirmedThe write reached the server.
cell:conflictThe write was accepted but the server row had moved underneath it. Last-write-wins with the divergence surfaced: your value stands and serverRow carries the server's truth.
cell:contextmenuRight-click on a cell.
cell:dblclickedA cell was double-clicked. Carries the row, column, value and text.
cell:mouseoverThe pointer entered a cell. Fires once per cell, carries what cell:clicked carries plus the cell element as target, and is delegated on the viewport so it stays correct over pooled rows.
cell:mouseoutThe pointer left a cell. Fires once per cell, including when the pointer left the grid; moving to the next cell fires this first, then cell:mouseover.
cell:mousedownA pointer button went down on a cell. Carries what cell:clicked carries plus the cell element as target, and is delegated on the viewport so it stays correct over pooled rows.
cell:mouseupA pointer button was released over a cell. Same shape as cell:mousedown.
cell:edit:endIt closed: committed or cancelled.
cell:edit:startAn edit session opened.
cell:pendingApplied optimistically, not yet durable. Only with edit.commit.
cell:revertedThe write failed. applied: false means a newer edit owned the cell, so nothing was written back.
row:pendingA row was appended or deleted optimistically, not yet durable. kind is 'append' or 'delete'. Only over a source that declares mutate.append/delete.
row:confirmedThe append or delete reached the server. An appended row has already been rekeyed from its temp key to the server key, and selection, expansion, focus and in-flight cell edits followed.
row:revertedThe append or delete failed: an appended row is removed, a deleted row restored. applied: false means a newer op owned the key, so nothing was undone.
row:conflictThe op succeeded but the server row had moved underneath it. Last-write-wins with the divergence surfaced: serverRow carries the server's truth.
form:closedThe row form closed without saving.
form:errorA commit from the form failed validation or was rejected.
form:openedThe row form opened.
form:savedThe row form committed.

Columns

EventFires when
column:filter:openHeader filter popup opened.
column:profile:openThe column statistics ("describe") panel was asked to open on a column, from the column menu's "Column statistics" item ({ colId }). A mounted tool panel opens its statistics panel seeded on that column.
column:groupedThe row-group column list changed.
column:menu:openHeader menu opened.
column:movedReordered by drag or by API.
column:pinnedside is 'start', 'end' or null.
column:pivotedThe pivot configuration changed.
column:resizedA column width settled after a drag or a keyboard resize.
column:visibleColumns shown or hidden.
columns:changedThe column set was replaced or reordered wholesale.
columns:taggedA column's tags changed.

Query and view

EventFires when
facet:computedA header histogram finished counting. Carries the column and the buckets.
facet:expandedThe facet band was opened or collapsed.
facet:failedA distribution could not be computed. Carries the reason.
facet:filteredA bucket or a dragged range was applied as a filter.
filter:changedThe condition tree or the quick filter changed.
page:changedFired after the rows have moved, whether the page changed by API or by the pager control.
sort:changedThe full sort entry list.
state:changedEvery state change, whether a user gesture or a programmatic call - including a named filters.where predicate registered, replaced, removed or reapplied - announced exactly once. cause is 'user', 'apply' or 'reset'; sections names the GridState keys that moved; report lists anything a restore could not apply. A save layer subscribes to this one event and ignores cause 'reset'.
state:resetThe grid was returned to its baseline.
timeline:attachedA time brush was connected to the grid.
timeline:detachedThe brush was removed.
timeline:seekThe brush settled on a range.
timeline:seekingThe brush is being dragged. Throttled.
annotation:changedA drawing annotation was added, edited or cleared. Carries the active tool and the mark count. Declared so grid.on('annotation:changed', ...) and the adapters' onAnnotationChanged reach it directly instead of via the '*' wildcard.
view:appliedEmits no storage write: applying a view changes nothing to persist.
view:defaultview is null when the default was cleared.
view:removedA saved view was deleted.
view:renamedA saved view was renamed.
view:savedCarries the one view that moved: enough to POST a single record without diffing two lists.

Selection and interaction

EventFires when
detail:toggledA master-detail row opened or closed.
group:toggledA group row opened or closed.
history:appliedAn action was undone or redone. Distinct from history:changed, which also fires when a new action is pushed onto the stacks and so cannot tell you anything was reversed.
history:changedEmitted after the entry is pushed, so a toolbar reading it names the right action. Repainting from sort:changed instead reads the timeline one action behind.
range:changedCell range selection changed.
scrollThrottled to the frame.
scroll:endScrolling settled, the moment to trigger deferred work.
selection:changedThe selected rows changed. Carries the keys.
size:changedThe viewport resized.

Cancellable before-events

Every user-initiated mutation has a paired cancellable before event. The handler receives a BeforeEvent carrying the action context plus preventDefault(reason?), defaultPrevented and reason. Calling preventDefault() - or returning false, the legacy kanban onBeforeMove idiom - cancels the action. A handler may be async; the mutation is held until every registered before-handler settles, so a confirm dialog or a server check genuinely gates the write. Any one handler preventing cancels it (veto wins), and a handler that throws is treated as a cancel and surfaced. On a veto the paired <action>:cancelled event fires carrying the reason.

These fire for user actions only. Host/API writes (for example grid.edit.setCells) and remote/router-applied deltas (rows.apply, origin !== 'user') do not fire them - remote truth is not a user gesture and does not self-veto. The origin field carried on each before-event lets a host deduplicate a module-initiated write (a kanban or Gantt move that re-enters core) from a genuine user gesture. If a handler was async and the underlying state moved during the await (a row removed, a value changed by a live delta), the gate re-validates and cancels with reason 'stale' rather than applying against state that has moved. With no before-handler registered every mutation stays synchronous and behaves exactly as before.

EventFires when
beforeEditBefore a validated cell/row commit applies. Carries row, key, mode, changes, origin. Validation (edit.validate) is separate and runs first. Paired with edit:cancelled.
beforeSortBefore a sort is set. Paired with sort:cancelled.
beforeFilterBefore a structured or quick filter is set (kind tells them apart). Paired with filter:cancelled.
beforeColumnMoveBefore a column reorder applies, earlier than the post-mutation column change. Paired with columnMove:cancelled.
beforeColumnResizeBefore a column width change applies. Paired with columnResize:cancelled.
beforeColumnHideBefore one or more columns are hidden. Paired with columnHide:cancelled.
beforeSelectBefore a user selection change applies; a veto snaps back to the last announced selection. Paired with selection:cancelled.
beforeRowAddBefore an optimistic row append applies. Paired with rowAdd:cancelled.
beforeDeleteBefore an optimistic row delete applies - the canonical confirm-before-delete hook. Paired with delete:cancelled.
beforeRowMoveBefore a row reorder applies. Paired with rowMove:cancelled.
beforeGroupBefore a group/tree expand or collapse applies. Paired with group:cancelled.
beforeRowReceiveBefore a row dragged from another grid is inserted into this one; fires on the receiving grid and names the row under the pointer (overKey). A veto leaves the source grid untouched. Paired with rowReceive:cancelled.
edit:cancelledA beforeEdit was vetoed; reason is 'stale' when a live delta moved the cell during an async gate.
sort:cancelledA beforeSort was vetoed.
filter:cancelledA beforeFilter was vetoed.
columnMove:cancelledA beforeColumnMove was vetoed.
columnResize:cancelledA beforeColumnResize was vetoed.
columnHide:cancelledA beforeColumnHide was vetoed.
selection:cancelledA beforeSelect was vetoed; the selection snapped back.
rowAdd:cancelledA beforeRowAdd was vetoed.
delete:cancelledA beforeDelete was vetoed; reason is 'stale' when the row was already gone.
rowMove:cancelledA beforeRowMove was vetoed; reason is 'stale' when the row had moved.
group:cancelledA beforeGroup was vetoed.
rowReceive:cancelledA beforeRowReceive was vetoed; nothing was inserted and the source still holds the row. reason is 'stale' when the row under the pointer or the source row was gone by the time an async handler settled.
export:requestA remote export was requested. Past-tense notification.
export:doneA remote export completed. Past-tense notification.
shortcuts:openedThe keyboard-shortcuts help overlay opened. Past-tense notification.
shortcuts:closedThe keyboard-shortcuts help overlay closed. Past-tense notification.
print:beforePrint mode is about to snapshot. Past-tense notification, not cancellable.
print:afterPrint mode restored the grid, even if the browser cancelled the print.

Presentation and formatting

EventFires when
formatting:changedA conditional formatting rule was added, edited, reordered or restated.
highlight:changedA highlight was added or cleared.
find:changedThe find query, its matches, the current match or the bar's open state changed; carries the FindCount, partial while the sliced scan runs.
permissions:changedThe context moved and every column re-resolved.
presentation:capturedA PNG was taken.
presentation:changedThe options of a running presentation changed.
presentation:endedPresentation mode ended. Annotations are cleared here.
presentation:scaleThe presentation zoom changed.
presentation:spotlightA region was spotlit or released.
presentation:startedPresentation mode began. Carries the scale, options, views and starting index. presentation:changed covers a later change to the same options, so a listener can tell entry from adjustment.
presentation:viewThe presentation advanced to another saved view.
redaction:changedA column was redacted or restored.

Collaboration

EventFires when
comment:addedA comment was posted.
comment:deletedA comment was removed.
comment:editedA comment was changed.
comment:failedA comment could not be saved. Carries the reason.
comment:indexLoadedThe comment index finished loading, so indicators can paint.
comment:resolvedA thread was marked resolved. Carries the cellKey.
comment:threadClosedA thread was closed or resolved.
comment:threadOpenedA thread was opened in the panel.
comment:unresolvedA resolved thread was reopened. Carries the cellKey.
presence:failedA presence transport error. Presence is lossy by design; this is informational.
presence:joinedA peer was seen for the first time. Carries the peer.
presence:leftA peer disconnected.
presence:lockRefusedAn edit was refused because a peer holds the cell.
presence:publishedThis client's cursor or selection was broadcast.
presence:updatedA known peer moved or changed selection. Carries the peer.

Everything else

EventFires when
clipboard:copyA copy left the grid.
diff:changedA snapshot was set or cleared.
diff:swappedThe baseline and the current rows were exchanged.
export:progressProgress on a streamed export.
header:contextmenuA column heading was right-clicked.
toolpanel:focusThe documented keyboard shortcut reached the tool panel.
tree:loadAbortedA child fetch was cancelled, usually because the node collapsed.
tree:loadFailedA child fetch failed.
tree:loadedChildren arrived. Carries the key and the count.
tree:loadingChildren are being fetched for a node.
views:changedThe whole list, plus what moved and why.