tom-select
tom-select copied to clipboard
Display remote data (API) without filtering
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
This has been covered somewhere in the discussions or issues. It would be good to add to the docs once found.
Thank you for your quick answer. Is this this issue (#78) ?
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()
})
},
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.
Facing the same issue here. However I cannot use
this.clearOptions()since I'm usingvirtual scroll pluginso I'd like user to have previosly loaded values.
I used clearOptions and just got stuck on virtual scroll not working.
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