dbrekalo / fastselect

Fastselect is lightweight browser plugin for enhanced select elements based on jQuery. Enables fast and sensible UI upgrade of select element with features like option searching and remote dataset loading.
http://dbrekalo.github.io/fastselect/
MIT License
108 stars 87 forks source link

Need to dynamically change the fastselect url parameter #11

Open vijichandran opened 7 years ago

vijichandran commented 7 years ago

Hello, I need to display the colleges based on the country. Initially i have select box to list the country and a text box to display the colleges in which the fastselect is enabled. When a user select the country, i need to pass the url with country name in the fastselect url parameter. How it can be implemented?

pascalvanegmond commented 7 years ago

You can change the url with this code: $('#fastselect').data('url', 'your_new_url' ).fastselect();

but i havent found the way to reload fastselect since this will only work once.

zdiodic commented 6 years ago

itis not working

darshan78261992 commented 6 years ago

I need cascading dropdown using Fastselect plugin and I got 80% of success. Below is my code $(function () { var $country = $("#Country"); $country.fastselect({ onItemSelect: function ($item, itemModel) {
var $state = $("#State");
$state.data("data-url", "../Base/GetState?countryId=" + itemModel.value); $state.removeAttr("disabled"); $state.fastselect({ onItemSelect: function ($item, itemModel) { var $city = $("#City"); $city.data("data-url", "../Base/GetCity?stateId=" + itemModel.value); $city.removeAttr("disabled");
$city.fastselect();
} });
} }); });

-My Issue Once you select Country it will state list and as per state selection, it will fill up city dropdown. Till here its working good but when trying to change country it won't reload state dropdown. Any Idea how to tackle this situation.