Topic: Updating Select not working smooth
m.hamacher priority asked 4 years ago
Hello,
in one of my projects I need to update a select based on an other select. I've worked out a working logic for that but during testing i noticed, that after a few changes (5-6 times) the update process starts lagging. I also tested the logic with plain jquery / html and there the problem does not occur. I also tried to destroy und recreate the select, but that didn't work either and as I read in an other question this is not longer necessary as the select automatically updates.
Any idea how I can fix the issue?
Expected behavior
Updating of a select works smoothly all the time.
https://codepen.io/mhamacher/pen/qBNyQrB
Actual behavior
After a few updates the updating process starts to lag.
https://mdbootstrap.com/snippets/jquery/m-hamacher/2673288
Resources (screenshots, code snippets etc.)
Marcin Luczak staff answered 4 years ago
Hi,
You can improve the performance of the select based on another select by adding data-stop-refresh='true'
to the select you want to refresh. Please see my snippet:
https://mdbootstrap.com/snippets/jquery/marcin-luczak/2675379
Regards, Marcin
m.hamacher priority commented 4 years ago
Hey Marcin,
thanks for the answer it really seams to be connected with the automatic refresh. After adding the data-stop and manually destroying and recreating the select, it works smoothly.
Thanks a lot.
Matthias
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB jQuery
- MDB Version: 4.19.1
- Device: Desktop
- Browser: All
- OS: All
- Provided sample code: No
- Provided link: Yes