tom-select icon indicating copy to clipboard operation
tom-select copied to clipboard

Display remote data (API) without filtering

Open Crovitche-1623 opened this issue 3 years ago • 6 comments

Hello,

I have a problem with the dropdown. I use Tom Select with an API that already handles typos etc. But it seems that tom select excludes results that do not explicitly contain the content of the input field. Could I just include the results returned by my API?

Sincerely

Crovitche-1623 avatar Oct 21 '22 09:10 Crovitche-1623

This has been covered somewhere in the discussions or issues. It would be good to add to the docs once found.

oyejorge avatar Oct 21 '22 15:10 oyejorge

Thank you for your quick answer. Is this this issue (#78) ?

Crovitche-1623 avatar Oct 26 '22 10:10 Crovitche-1623

Thank you @oyejorge. I tried to fix my select today and #78 was the correct issue. I had to add the clearOptions() in the load function and set my searchField to an empty array. Maybe we can add something in the documentation about it ?

// Fetch remote data
load: function (query, callback) {
  const url = parent.urlValue + '?q=' + encodeURIComponent(query)

  fetch(url)
    .then(response => response.json())
    .then(json => {
      this.clearOptions()

      callback(json.hits)
    }).catch(() => {
      callback()
    })
},

Crovitche-1623 avatar Nov 22 '22 18:11 Crovitche-1623

Facing the same issue here. However I cannot use this.clearOptions() since I'm using virtual scroll plugin so I'd like user to have previosly loaded values.

pySilver avatar Jun 19 '23 22:06 pySilver

Facing the same issue here. However I cannot use this.clearOptions() since I'm using virtual scroll plugin so I'd like user to have previosly loaded values.

I used clearOptions and just got stuck on virtual scroll not working.

juniwalk avatar Oct 18 '23 11:10 juniwalk

This issue has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Feb 16 '24 01:02 github-actions[bot]