Topic: Add/Remove of select options multiplies nested wrappers

3aalliance free asked 4 years ago


Expected behavior Hello, Support Team, While using mdb-select dynamic adding/removing options would work stable.

Actual behavior I use this html code of mdb-select:

Ingress Port

I add option to this select with this function:

$('#ingressDpidField').on('change', function() { var optionList = ''; optionList = optionList + 'One'; optionList = optionList + 'Two'; optionList = optionList + 'Three'; $('#inPortField').append(optionList); });

Then I remove options with this function:

$('#egressDpidField').on('change', function() { $('#inPortField option[value="1"]').remove(); $('#inPortField option[value="2"]').remove(); $('#inPortField option[value="3"]').remove(); $('#inPortField').materialSelect(); });

At first glance everything works good. Although if repeat the above many times in development tool I see that select-wrapper multiplies its own nested copies infinitely Snapshot On some cycle browser became slow. This behavior does not depend on hw/sw platform and browser type/version.

I tried to remove select after removing of options with $('#inPortField').materialSelect({ destroy: true }); , but this does not help. Please help me to understand what I am doing wrong and fix an issue.

Than you!


Mateusz Łubianka staff commented 4 years ago

Hi @3aalliance,

please, create a snippet showing your problem here: https://mdbootstrap.com/snippets/. I'll try to help you.

Best,


Victor Rivero premium answered 4 years ago


Hello, Im also having the same issue, here is a snippet of it

https://mdbootstrap.com/snippets/jquery/vrivero/2085699


Grzegorz Bujański staff commented 4 years ago

Hi. We have a task on our to-do list to improve it.


Victor Rivero premium commented 4 years ago

Can you give us some estimate on when this is going to be fixed, I want to know if I should wait or if I should fix it by myself.


Grzegorz Bujański staff commented 4 years ago

Unfortunately not. At the moment I can't say when it will be fixed


Unicomp pro commented 4 years ago

This is a critical problem!


wealthtechs priority commented 4 years ago

It's the same thing https://mdbootstrap.com/support/jquery/materialselect-launched-without-call/ , seems like the mutation observers on the select doesn't disconnect properly when destroy is called


Grzegorz Bujański staff commented 4 years ago

We will fix it as soon as possible.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.14.0
  • Device: x86
  • Browser: Chrome, Forefox
  • OS: Ubuntu 18.04, MS WIn 10
  • Provided sample code: No
  • Provided link: No