Skip to content

overlay

The message over the rows: loading, an error, nothing to show.

Type'loading' | 'error' | null
Defaultnull
Live update (update())Yes
Angularthe [overlay] input
<dz-grid>the overlay attribute
Declared inpackages/dom/src/settings.ts

Left out (or null), the grid decides by itself: « Loading… » while a server’s first rows are on their way, the error message when a server’s request failed, « No rows » when there are none, « No rows match the filters » when the filters or the search hide them all — and nothing otherwise. Under the error message, forced or not, a « Retry » button asks the rows again (a server’s: a new request).

'loading' and 'error' force one, whatever the rows: for an application that loads its rows itself and gives them with rows. Give null again once they are there. The texts are the bundle’s (grid.loading, grid.error, grid.noRows, grid.noMatches); a part can draw the overlay instead (slots()).

To say that rows on screen are being reloaded, without covering them, use busy.

import { createGrid } from '@dzgrid/dom';
import { EN } from '@dzgrid/dom/locales/en';
type Station = { id: string; name: string; rain: number };
const grid = createGrid<Station>(document.getElementById('stations')!, {
columns: [{ id: 'name', header: 'Station' }, { id: 'rain', header: 'Rain (mm)', type: 'number' }],
getRowId: (s) => s.id,
messages: EN,
overlay: 'loading',
});
fetch('/api/stations')
.then((r) => r.json() as Promise<Station[]>)
.then((rows) => grid.update({ rows, overlay: null }))
.catch(() => grid.update({ overlay: 'error' }));

No overlay set and no rows: the grid says « No rows » by itself.

  • busy — rows reloaded and kept on screen.
  • Server data — the overlays a server’s rows bring by themselves.