setCellMeta with AJAX call debounced

Tags: #<Tag:0x00007efc648cb6f0> #<Tag:0x00007efc648cb510>

Hi HoT Team,

Given this example,

is there a way to debounce the callback function for setCellMeta for setting the source of the autocomplete, so that it won’t send any server request on every keystroke?

Thanks

Hi @r.evangelio

Do you have already any progress here? If you do, it would be easier to propose something. In general, you might use beforeChange hook to block the changes that shouldn’t be send to the server: https://handsontable.com/docs/javascript-data-grid/api/hooks/#beforechange

@adrian.szymanski

See this example:

hot?.setCellMeta(row, col, 'source', async (query: string, process: (items: string[]) => void) => {
  const res = await fetch('some/url').
  process(res.data);
});

When the user types, it invokes this callback function straightaway. I tried to use Handsontable debounce helper but it still process it due to the fact that the callback function was still invoked.

Hi @r.evangelio

I will close this topic now, as we moved the discussion here: https://github.com/handsontable/handsontable/discussions/10484