Topic: materialSelect launched without call
wealthtechs priority asked 4 years ago
After destroying material select, when I update the options elements on DOM whit .append, .prepend or .html the "materialSelect()" method is called automatically. How to prevent this behavior? Why the select is initialized again without any call?
Snippet: https://mdbootstrap.com/snippets/jquery/wealthtechs/2097941
Also, and more critical, each insert duplicates the wrapper on select, so we can't modify our options because this generates a chain of dups (inspect the wrapper after 3 clicks on the button)
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Opened
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB jQuery
- MDB Version: 4.18.0
- Device: PC
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: Yes
Grzegorz Bujański staff commented 4 years ago
Hi. I can't open your snippet. Did you click publish?
wealthtechs priority commented 4 years ago
I saved as draft, sorry please try again
Grzegorz Bujański staff commented 4 years ago
Ok, I got it. Actually, something is wrong. We will check and fix it.
Victor Rivero premium commented 4 years ago
In the meantime you can add
data-stop-refresh="true"
to stop the observer from re-initializing the material select