Skip to content

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.

ts
{ 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.

OptionValueDefaultEffect
source(query, ctx) => Promise<item[]>requiredReturns the list; an item is { value, label? }
debounceMsinteger 0-2000 (ms)250Wait after the last keystroke before requesting
minCharsinteger 0-101Minimum characters to request; 0 also requests the empty query when the editor opens
noResultsTextstringper languageText in the list when the result is empty
loadingTextstringper languageText in the list while waiting
maxHeightinteger 80-600 (px)240Maximum 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 ​

SituationBehavior
TypingOne request after debounceMs; a new key restarts the timer
New key while pendingThe previous request is aborted with an AbortController and a new one starts; a late old response is dropped
While waitingaria-busy="true" on the input and loadingText in the list
Empty resultnoResultsText in the list
Request failsError text in the list (role="alert") and one error event (callback-error); the editor stays usable and retries on the next key
Esc, commit, closeAborts a pending request and clears the timer; destroy() does the same
IME inputRequests 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.

ts
{ 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.

See also ​