Skip to main content

afterFlush()

afterFlush(fn): void

Defined in: js-api/src/u2core/signals.ts:53

Runs fn once the outermost batch has ended and the effects it set off have run — what an effect builds in answer to a write (a new row) exists then; outside a batch, now. u2 runs every handler in a batch. A throw is thrown at whoever ended the batch: hand it a Scope.bind handler to have it reported instead.

Parameters​

ParameterType
fn() => void

Returns​

void

Example​

rows.value = [...rows.value, record];
DG.U2.afterFlush(() => list.querySelector('input')?.focus());

See​

https://public.datagrok.ai/js/samples/ui/widgets/u2-lens