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.
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?
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?