Skip to content
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

Support multiple init calls on the same element #18

Closed
ivaynberg opened this issue Apr 10, 2012 · 8 comments
Closed

Support multiple init calls on the same element #18

ivaynberg opened this issue Apr 10, 2012 · 8 comments
Assignees
Milestone

Comments

@ivaynberg
Copy link
Contributor

Multiple invocations of .select2({}) should be supported in case elements are updated via ajax. also, maybe a .select2('destroy') method...

@ghost ghost assigned ivaynberg Apr 10, 2012
@justindujardin
Copy link
Contributor

+1 for this.

Currently I get around this limitation by destroying elements when I'm done with them, but it would be great to be able to 'destroy' them, returning the HTML elements to their original state.

@ProLoser
Copy link
Contributor

+1 for this.

Something similar to trigger update or something?

Could do elm.select2('refresh')

I need this to address #23

@ProLoser
Copy link
Contributor

Would you have to pass the configuration object every single time? Wouldn't it perhaps be easier to just pass something like elm.select2('refresh')?

@ivaynberg
Copy link
Contributor Author

i dont get how this relates to #23. #23 is about updating the selected items when the change() event is fired. this is about updating choices available for selection. these choices are updated every time the select box is opened...

@ProLoser
Copy link
Contributor

I was referring to the problem you originally mentioned, but it sounds like that's not actually an issue because the options list is refreshed Every time you click. If That's the case then everything should work fine for me.

I just figured you would've open the ticket yourself for a reason.

Sent via Hubroid

@ivaynberg ivaynberg reopened this Apr 12, 2012
@ivaynberg
Copy link
Contributor Author

ah. sorry. i commented on the wrong issue. thought we were still talking about #23. my bad.

@ivaynberg
Copy link
Contributor Author

added destroy method, also more then one initializationis allowed on the same element - old one will be destroyed.

@drosen0
Copy link

drosen0 commented Apr 12, 2012

Thank you for this.

Gataniel pushed a commit to Gataniel/select2 that referenced this issue Jul 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants