busy
For an application that reloads rows it keeps on screen — a poll every minute, its own refresh button.
| Type | boolean |
|---|---|
| Default | false |
Live update (update()) | Yes |
| Angular | the [busy] input |
<dz-grid> | the busy attribute |
| Declared in | packages/dom/src/settings.ts |
What it does
Section titled “What it does”true: the grid says aria-busy="true" at once, and after 200 ms shows a thin bar under the header; once shown, the
bar stays at least 400 ms, so a quick reload does not flicker. The rows stay readable and usable. Nothing is
announced: a reader is not interrupted for a refresh. false ends it.
A server’s rows (source) do this by themselves when a request is made with rows kept on screen; busy is for the
rows you give. The bar never shows with the « Loading… » overlay. Under
motion: false or reduced motion, the bar is still; a part can draw your own instead (slots()).
Example
Section titled “Example”import { createGrid } from '@dzgrid/dom';import { EN } from '@dzgrid/dom/locales/en';
type Train = { id: string; line: string; delay: number };
const grid = createGrid<Train>(document.getElementById('trains')!, { rows: [{ id: 't1', line: 'Coast line', delay: 4 }], columns: [{ id: 'line', header: 'Line' }, { id: 'delay', header: 'Delay (min)', type: 'number' }], getRowId: (t) => t.id, messages: EN,});
setInterval(async () => { grid.update({ busy: true }); const rows = (await (await fetch('/api/trains')).json()) as Train[]; grid.update({ rows, busy: false });}, 60_000);import { Component, signal } from '@angular/core';import { DzGrid, type DzgColumnOrGroup } from '@dzgrid/angular';import { EN } from '@dzgrid/dom/locales/en';
type Train = { id: string; line: string; delay: number };
@Component({ selector: 'app-trains', imports: [DzGrid], template: `<dz-grid [rows]="rows()" [columns]="columns" [getRowId]="rowId" [messages]="messages" [busy]="loading()" />`,})export class Trains { readonly rows = signal<Train[]>([{ id: 't1', line: 'Coast line', delay: 4 }]); readonly loading = signal(false); readonly columns: DzgColumnOrGroup<Train>[] = [{ id: 'line', header: 'Line' }, { id: 'delay', header: 'Delay (min)', type: 'number' }]; readonly rowId = (t: Train) => t.id; readonly messages = EN;
async reload(): Promise<void> { this.loading.set(true); this.rows.set((await (await fetch('/api/trains')).json()) as Train[]); this.loading.set(false); }}<dz-grid busy></dz-grid>import '@dzgrid/element/define';import type { DzGridElement } from '@dzgrid/element';import { EN } from '@dzgrid/dom/locales/en';
type Train = { id: string; line: string; delay: number };
const grid = document.querySelector<DzGridElement<Train>>('dz-grid')!;grid.columns = [{ id: 'line', header: 'Line' }, { id: 'delay', header: 'Delay (min)', type: 'number' }];grid.getRowId = (t) => t.id;grid.messages = EN;grid.rows = (await (await fetch('/api/trains')).json()) as Train[];grid.removeAttribute('busy');Live demo
Section titled “Live demo”busy: true — the rows stay, a thin bar under the header says they are being reloaded.
See also
Section titled “See also”overlay— a message over the rows.- Server data.