-
-
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
Doesn't reset on form reset #1315
Comments
try this
|
The default value is different across several elements. This works for me: $('form').on('reset', function(event){
$('.selectpicker',this).each(function(index, element){
var $this = $(this);
setTimeout(function(){
$this.selectpicker('val',$this.val());
},0);
});
}); Still, I believe there should be some sort of integration such that the control behaves as the control it overrides. |
This should work: $('form').on('reset', function() {
setTimeout(function() {
$('.selectpicker').selectpicker('refresh');
});
}); |
My understanding is that you can have more than one form on a page and that reset buttons (or reset events) only reset the form they are associated with. Your code would reset Seperately, I do see that you're using a different command, |
Ah, I see... Slight modification to take multiple forms into account as well as dropping the $('form').on('reset', function() {
var _this = this;
setTimeout(function() {
$('.selectpicker',_this).selectpicker('refresh');
});
}); |
I like this solution: $('.selectpicker').selectpicker('refresh'); and I am using it successfully (thanks, caseyjhol). But I agree with previous comments that the regular Reset button should work out of the box with bootstrap-select. It would be nice if bootstrap-select could be improved so that no additional fiddling is necessary. |
+1 |
1 similar comment
+1 |
Please release this. Its default behaviour, and a long standing issue... |
This change will be a part of the v1.14.0 release. This issue will be updated after it's made available. |
Released in v1.14.0-beta! |
For me is still not working, when I call I tried with I am on bootstrap@4.5.3 + bootstrap-select@1.14.0-beta |
@soyxan Can you link me to an example? |
In the following link you can check 2 issues I am facing:
https://codepen.io/soyxan/pen/JjbwzKR Thanks! |
Why is this issue closed, both of the issues on my previous post are still not solved, right? Thanks!
|
@soyxan In your example, you're not calling |
When you reset the form (via reset button), the underlying
<select>
resets, but the control doesn't update to match.The text was updated successfully, but these errors were encountered: