Remote search editor
cellEditor: 'remote' fills its list by asking a server as you type. It suits values with too many items to download at once, such as customers or product codes. The list and keys are the same as in the Combobox editor.
{ id: 'customer', editable: true, cellEditor: 'remote',
editorParams: {
source: async (query, { signal }) => {
const res = await fetch(`/api/customers?q=${encodeURIComponent(query)}`, { signal });
return (await res.json()).map((c) => ({ value: c.id, label: c.name }));
},
minChars: 2,
} }It needs the optional editors bundle (maxgrid/editors in the modular build). Without the bundle, creating the grid fails with invalid-option. source is required; without it the grid fails at creation with invalid-option. The grid never calls fetch itself: every request happens inside your source.
Options
All go in editorParams.
| Option | Value | Default | Effect |
|---|---|---|---|
source | (query, ctx) => Promise<item[]> | required | Returns the list; an item is { value, label? } |
debounceMs | integer 0-2000 (ms) | 250 | Wait after the last keystroke before requesting |
minChars | integer 0-10 | 1 | Minimum characters to request; 0 also requests the empty query when the editor opens |
noResultsText | string | per language | Text in the list when the result is empty |
loadingText | string | per language | Text in the list while waiting |
maxHeight | integer 80-600 (px) | 240 | Maximum list height |
ctx is { signal, row, rowKey, columnId }. Pass signal to fetch so a cancelled request really stops. At most 200 results are shown. Items must be plain { value, label? }; anything else is treated as an error.
Request flow
| Situation | Behavior |
|---|---|
| Typing | One request after debounceMs; a new key restarts the timer |
| New key while pending | The previous request is aborted with an AbortController and a new one starts; a late old response is dropped |
| While waiting | aria-busy="true" on the input and loadingText in the list |
| Empty result | noResultsText in the list |
| Request fails | Error text in the list (role="alert") and one error event (callback-error); the editor stays usable and retries on the next key |
| Esc, commit, close | Aborts a pending request and clears the timer; destroy() does the same |
| IME input | Requests after the composition ends |
Label of the stored value
Picking an item stores option.value. The grid cannot know the label (the name) of a stored value. Decide what the cell shows with the column's formatValue or optionLabel; without one the stored value is shown as it is.
{ id: 'customer', cellEditor: 'remote',
formatValue: (id, row) => row.customerName ?? String(id) }Text that was not picked is not a value. Enter on it does not commit and shows "Pick an item from the list."; committing without touching keeps the old value. Clearing the text and committing gives null.
Gallery example: edit-remote-search
Gallery example: edit-remote-errors