-
-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.sortField doesn't work with remote data ? #192
Comments
Can you give me a little more to work with? Example JSON for a query along with the display you see vs the display you'd like to see? |
Actually, I think this is what you're looking for ...
fetch(url).then(response => response.json()).then(json => {
this.clearOptions(); // <-- clear options from previous queries
callback(json.items);
}).catch(() => {
... |
Sorry, it didn't work. Here is the example: https://jsfiddle.net/mArtinko5MB/k7nbsf5a/59/ What is expected: Write "ale" into selectbox so it starts request. expected order is:
But it isn't ( it's Zanythingá, Komethingova, Tsomethingova). The funny thing is that when i change values ( names ) to Tsomething, Ksomething, Zsomething and write "ale" into SB, it suddenly works and order is as expected. I have no idea what is going on. Bug is somehow connected to how string is computed in sort function. |
Shoot, that's right.
The solution is to make sure sortField: [{field:'name'},{field:'$score'}], or sortField: [{field:'$order'},{field:'$score'}], |
Great, it works. Thanks ! |
Hi, remote data settings for tom-select does seem to corrupt original order of json response.
I am using code below:
sortField doesn't seem to do anything and i am not setting any order in options. What's the catch ?
The text was updated successfully, but these errors were encountered: