I am developing a ajax search-box with drop-down(HTML select). The search-box is going to allow filter the posts in admin area by its category. Total category is going to be over 5,000. I want to show the newest 100 category in drop-down by default. But if user start typing in search-box it should fetch the matching categories from database(Ajax search) and show those matching categories instead of the default 100, if the user empty the search-box the default 100 category should show again.
I tried to achieve it using Select2 but I think it only allow ajax search. Is there any way to achieve this in select2 ? Or is there any better JavaScript/jQuery plugin which can do this?
Serdar Sanri
Sr. Frontend Developer
You may create a textbox and a floating div underneath ( similar to what bootstrap dropdown or select2 does) then when field is empty you can show a preset list of data. Then when user starts typing tou can filter main data and rerender the dropdown. I am on my phone right now but i will try to create a sandbox tonite when i get on my computer