-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Slim Select based on ajax result #31
Comments
Thank you for pointing this out. I have wanted to do an ajax example/adjustment to make it work. Ill put some time into it soon and update you when im done. Do you have a deadline you need to hit? |
Hey there, Juste shiming in to say that this vanilla select is the neatest I found so far, I would love to use it and this syncing problem is the one thing keeping me from doing so. Thanks for the great work. |
Sounds good. ill get on this update soon. |
Thx for responding so quickly. |
Anything you can send me visually to help me understand your needs would be great. In any case like i said before I will try to implement a way to easily integrate ajax ability. |
Ok , You can expect this tomorrow. |
👍 |
Ok, i made a test example to explain in a visible way. Later on there will be an extra statement that the ajax call will only happen at 3 char but not to point out our "problem". Could it be possible to make an extra sync in setData (simulating keychange) so the SS-list is not 1 step behind? At this moment you have a "onchange" and "beforeonchange" in the select but would be create if there would be an "onchangeinput". I hope this helps abit :) . |
Also i receive the following error (https://imgur.com/a/wFC3i) when i reopen the select (screenshot 7, action: open select). |
I see what you are talking about now. Thanks for this. I put a good amount of work into it over the last couple of days and will hopefully be able to wrap this up fairly soon. Ill let you know once im done. Or at least let you know when you can test it out to make sure it works for your needs. Thanks! |
Extra method suggestion ('setSearchText'). Info: Reason: Example: Conclusion |
I like it. It would be easy to add and would give some additional info on whats going on. |
Hi brianvoe |
@khoapercy slim select doesnt use checkboxes. |
Do you think you will be able to implement this before the 1st of april. |
Sorry things have been super busy. im 80% there ill try to wrap it up soon. definitely before april 1st |
Ok I completed the addition of ajax implementation. See docs options for example usage. v1.12.0 Let me know if you have any questions or issues you come across. Thanks! |
Thx, i will try it today/tomorrow and give you feedback. |
ok, i did a small test and i have a remark (without screenshots) At this moment you can have 3 options for the callback if i am correctly.
My remark is for the "false" option. Example: So what i propose is that if false is given to the callback that the slim-select behaves normal. |
So whether or not you do the fetch is up to you. The ajax function just give you the search and a callback function to use if you want to pass in values that you fetch. new SlimSelect({
select: '#select',
ajax: function (search, callback) {
// Do whatever you need to here
// If you decide to do a fetch, then you can use the callback function to pass your data or a message you want to display
callback('I found no results')
// or
callback(data)
}
}) |
Sorry for not responding for a while. |
👍 Thanks! |
Hello,
Info :
I would like to use the slim select combined with ajax results.
The reason i do an ajax request is because i have several 1000 records based on a different input field(country selection).
Situation :
Event : " .find('input').on('keyup',...)"
Execute : Ajax call -> change options
Problem :
The select has a "ss-list" with all the options, these have a "data-ID".
I always do a ".setData" when any "keyup" event happens in the input from the select, because of this all the "data-ID" are always different (I will ofc only do this request at +- 3 char).
The mayor issue that i have at the moment is that the slim-select is not synced with itself.
I mean that it seems that the slim-select has like an array that has all the data-ID and this sync on every keyCode with a CHAR but after a change i update it with the return value with my ajax results.
So the js values are always 1 step behind the html values, atleast that's how it feels.
Example
1 ) 1 option -> data-ID = 100;data-ID = 110;
2) Extra key input "a"
3) Select syncs, data-ID = 100;data-ID = 110;
4) Ajax request (input field has changed)
5) Setdata, data-ID changes in the list -> data-ID = 200;data-ID = 210
6) Choose value, option 200 -> list = 200, select = 100
7) Result -> 200 is not known so "null" has been selected
8) Open search field
9) Select syncs -> data-ID = 200;data-ID = 210
10) Choose value -> list = 200, select = 200
11) Result -> 200 is known so return selected value the "span"
Conclusion
It seems like the slim-select always syncs on a change (visible key) or open/close.
Can i maybe call this function after my ".setData" so the ss-list syncs with the js data?
Greetings aro
The text was updated successfully, but these errors were encountered: