Skip to content

Re-Rendering breaks event listeners #2824

@Ov-ille

Description

@Ov-ille

I'm using selectpickers that are updated through javascript based on other selections (enabled/disabled, added/deleted options).
I have found that sometimes this is only possible by destroying and rerendering the selectpicker, which works fine.

However, now I have noticed that this seems to break eventlisteners based on the selectpickers.

I have created a simple example here: https://jsfiddle.net/L23zr09u/

Both dropdowns are supposed to print somethign to the console, when the dropdown opens. For the first one this works, for the second one that gets destroyed and rendered, there is no response.

Am I doing something wrong or is this a bug? And is there a way around it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions