Skip to content

searchWarmup

For a large grid with a search box: the first letter typed answers at once.

Type'idle' | 'off'
Default'off'
Live update (update())Yes
Angularthe [searchWarmup] input
<dz-grid>the settings property: el.settings = { searchWarmup: … }
Declared inpackages/dom/src/settings.ts

The quick search reads every row’s text once, then keeps it. By default ('off') it does so in idle time once a search box takes the focus — a reader who types at once may still wait on a large grid. 'idle' does it after each load, in the browser’s idle time, without holding up the page: the first keystroke then finds everything ready.

The cost is memory: the prepared texts stay held, about 600 bytes a row for ten text columns. Leave it off for a small grid or a page with no search box. It only matters with the search feature (quickSearch() from @dzgrid/dom/search), and in the browser: a server’s search reads nothing.

import { createGrid } from '@dzgrid/dom';
import { quickSearch } from '@dzgrid/dom/search';
import { EN } from '@dzgrid/dom/locales/en';
type Cloud = { id: string; name: string; height: number };
const search = quickSearch();
createGrid<Cloud>(document.getElementById('clouds')!, {
rows: [{ id: 'n1', name: 'Cirrus feather', height: 9000 }],
columns: [{ id: 'name', header: 'Cloud' }, { id: 'height', header: 'Height (m)', type: 'number' }],
getRowId: (c) => c.id,
messages: EN,
searchWarmup: 'idle',
features: [search],
});
search.bind(document.querySelector<HTMLInputElement>('#cloud-search')!);