-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Ajax with method selectpicker('refresh') #1481
Comments
Hi. |
I am with the same issue using Angular 2. The values are not loading on |
remove the class and attr data-live-search from the code the ajax brings back... |
It don't work for me :-( |
Hi |
$('#').selectpicker('refresh'); works fine |
.selectpicker('refresh') does not always work when your using jquery to add/change elements in the select. They change in the DOM but do not refresh every time, Its hit and miss. I have tried to refresh the select after each change, tried to render the select after each change, tried to refresh on a DOM change, nothing works perfectly. Obviously this is a large issue, as there are literally hundreds of questions regarding this issue anywhere from git to slack. #('.selectpicker').selectpicker('refresh'); <-- this should work and only need to be fired at the end of the change to the DOM. It does not work 100% of the time. more like 60/40. |
OK, So i don't know about anyone else BUT i found a fix or maybe it what was wrong altogether. I have no idea but this fixed my issues. make sure the classes"form_control & selectpicker" [class="form_control selectpicker"] are used together. Hope this works for someone else. |
Looking at the original code, it seems the issue is $(document).ready(function(){
$('#inputESTADO').change(function(){
$('#inputCIDADE')
.load('ajax/cidade.php?estado='+$('#inputESTADO').val())
.selectpicker('refresh');
});
}); If somebody is actually having an issue with Please 👍 and follow #899. |
This work for me. Flow this. $('#projectList').selectpicker('refresh').empty().append('sadsadsa').selectpicker('refresh').trigger('change'); |
I had the issue too. I solved with the comment of the user "Designtoo" by eliminating the class of the selectpicker and adding it again after the success function with the 'refresh' of the .selectpicker. Here is the relevant piece of the code:
|
trigger change will call network again |
Thanks for sharing your answer I have the same problem and I tried from 3 days. and finally, I find this answer and this work for me |
This one is worked for me.Great thanks |
Hi Folks,
I have a little trouble that leave me crazzy, because I dont Know if problem is directly method selectpicker('refresh') or logical programmer.
I have a simple html form with two combobox, Firstly you fill the first combobox (inputESTADO) and dynamiclly the second combobox (inputCIDADE) is filled with values from array php. Both combobox its with class='selectpicker' attribute.
The case is, The 'selectpicker' class in both, the second combobox not load the values. If I remove the class, the form work well with ajax. I searching here about ajax issues, in my javascript, I add the .selectpicker('refresh') to load the new values from first combobox.
Now, the form work partial, because the second combobox just change the values for last choice from combobox one.
Example
My javascript
This way, the form work partial, because I need choose an value from combo inputESTADO and state of combo inputCIDADE not change, BUT, if I change again combo inputESTADO, the inputCIDADE load the values from first choise. Its leave crazzy...
If I remove class='selectpicker' from inputCIDADE select tag, the form work perfectly.
My doubt is, this problem is direct from my logical in javascript or I need add something on selectpicker to load these values on my second combobox.
The example here in AJAX Form Example
Hugs,
Mentrac
The text was updated successfully, but these errors were encountered: