mdb-select keeps nesting select-wrapper after dynamically op


Topic: mdb-select keeps nesting select-wrapper after dynamically option insertion

Jorge Nuñez Malledo asked 5 years ago

Hello friends,

Hope you are doing ok in Poland.

When dynamically adding option via jquery script, mdb-select keeps nesting select-wrapper's divs outside original select, in an exponential way. Eventually, the session crashes. In the snipped below, session crashes after the 10th option insertion. By the time, the number of nested select-wrapper's div is... 512!

Am I doing something wrong?

Thank you and take care

Resources (screenshots, code snippets etc.)

https://mdbootstrap.com/snippets/jquery/jorge_nunez_malledo/1946445


Grzegorz Bujański staff commented 5 years ago

Hi. We fine, thanks. I add this case to our to do list. We will look at this and fix as soon as possible.


Jorge Nuñez Malledo commented 5 years ago

Glad to hear that,

This behavior continues even after material select is destroyed, as if there's a listener upon select changes. Is there any chance to temporary disable such a listener? If so, I could try to workaround this by

  1. Disabling the listener
  2. Performing select modifications
  3. Re-enabling the listener

(Probably complemented with material select destroy/init)


Grzegorz Bujański staff commented 5 years ago

Unfortunately we don't have any method to disable listeners in material select.


Jorge Nuñez Malledo commented 5 years ago

Ok,

Since you're unable to provide a workaround for this issue, please make sure that the fix is included in the next product release

Cheers


Turner pro premium answered 5 years ago

Hi

I have come across exactly the same problem with mdb-select nesting select wrappers exponentially. I am not using any listeners and cannot figure out how to overcome or workaround this problem.

According to a support response of 9 months ago on topic "Material Select update/destroy options for a specific mdb-select", just appending or removing will automatically recreate the the select but in my case a new nested select wrapper is created and I can't figure out any way to stop this happening. BTW I have tried the method suggested in the response to the topic "Material Select update/destroy options for a specific mdb-select" with no luck.

Could you please advise.

Thanks and regards


Turner pro premium commented 5 years ago

I have create a snippet which is based on the previous authors code which shows the problem I am experiencing.

https://mdbootstrap.com/snippets/jquery/turner/2005135


Grzegorz Bujański staff commented 5 years ago

Hi. As I say above, for now we don't have any solution for this issue. We will fix this as soon as possible.


Turner pro premium answered 5 years ago

OK and thank you for your clarification. In the interim I will stop using mdb-select (unfortunately) and will use normal select which I found works perfectly OK.

I look forward very much to the fix.

Thanks again.


Grzegorz Bujański staff commented 5 years ago

Ok. We are planning a refactor for this component. We will keep this error in mind and fix it.


Turner pro premium commented 5 years ago

Are you able to provide an estimate of when this issue will corrected? It worked OK in earlier versions plus it works OK with non mdb-select. I really would like to use mdb-select in my current project but I am running out of time and need to decide to use something else very soon.

Thank you.


Grzegorz Bujański staff commented 5 years ago

Hi. Yes, we will fix this in the next release :)


Jorge Nuñez Malledo commented 5 years ago

Hi Grzegorz,

Hope this release fix the destroy procedure as well (probably the same bug). This method should destroy the material select for good


Grzegorz Bujański staff commented 5 years ago

Yes, it's the same bug. I checked your code in our test environment and this patch will also fix the bug you found :)


Turner pro premium answered 5 years ago

Great news, thank you.


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
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.15.0
  • Device: Lenovo T480
  • Browser: Mozilla Firefox 74.0.1 (64-bit)
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes