-
-
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
bootstrap-select not working when .clone(true) in jQuery #605
Comments
The way boostrap-select works is by converting a normal Select into a bootstrap-select,. And then mirrors any modifications. So all your actually doing is cloning the invisible normal select, and then the visible bootstrap-select. But all the javascript that's attached to these has not been cloned. The way I would do it, first do your clone. Then remove the bootstrap-select that was created, and then re-initialize the normal cloned Select again.. eg->
And jsFiddle -> http://jsfiddle.net/N663T/20/ |
Wow. Your work saved me a lot of time. I really appreciate it. Thanks! :D |
Thank you so much! I have been trying hard to find a solution for this !! |
Thank you man! |
I came across this problem but if you're using the latest version, the select is placed inside the .bootstrap-select element for HTML5 error handling purposes. The Instead of: Use: This will replace the .bootstrap-select element with the select element that it contains inside, Just thought I'd share in case anyone has the same problem. |
Use: |
Thanks! work for me :) |
How to create delete button? |
I followed @joejordanbrown, but I am finding that my selection isn't preserved after cloning. Am I required to scan the copied selectpickers for their selection, and transfer these over to the cloned selectpickers? |
I had to clone the select first before replacing, I assume it was perhaps being destroyed during the replace? In this example newref is my clone.
|
Thanks! |
Why can I work inside the bucle "find(select).each"? for I can to clone multiples selectpicker |
Have the same issue. When I use: |
Surefyre's suggestion worked.... |
Maybe one of you are able to hint what I'm doing wrong. I clone the tr on button click. the selectpicker is initiated before the click. When I clone the table row first and then open the selectpicker I get an error. When I open the original picker and then the cloned one, I don't get an error but the dropdown is referencing to the first select box. Error: bootstrap-select.min.js:8 Uncaught TypeError: Cannot set property '_menu' of undefined Basically this is the code I'm working with:
I tried to work with unique IDs as well, but it didn't work as well. |
@LuTheZy : yes even i was facing this issue after replace with but later i found that you need to add one more line of code something like this. cloned .find('.selectpicker').selectpicker('render'); .selectpicker('render') You can force a re-render of the bootstrap-select ui with the render method. This is useful if you programatically change any underlying values that affect the layout of the element. Hope this helps you. If you have already resolved the error, then I am sorry for posting it late. |
Good ! Thx |
The select picker worked, but the onchange event not working. |
This!!!! |
This perfectly helps me out! It doesn't even break nor change your current value if your remove the bootstrap select so it is definitely a life saver |
Does bootstrap-select really support cloning? I've followed some snippets found in #157 and still it doesn't work. I've tried to include "true" in .clone() but it turns out that it will only affects the events of the original.
Here's the code. Let's assume that the id "packing" is a div containing input text boxes and a select. I want to prepend/append the clone to a div.
Here's also the JSFiddle: http://jsfiddle.net/rougin/N663T/2/
The text was updated successfully, but these errors were encountered: