Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Can I share Options for using in many Select element

leejoo71 free asked 4 years ago


After create material, it create select-wrapper, with unqiue INPUT & UL, Can I use UL for other select-wrapper, it is because I have many select will use same OPTION data


Krzysztof Wilk staff answered 4 years ago


Hi!

I made a snippet for you with a working example. You can find it here: https://mdbootstrap.com/snippets/jquery/krzysztof-wilk/2842956#js-tab-view

Best regards


leejoo71 free answered 4 years ago


I use the select for order place input and with many item per order and each item have product, currency and unit and those are use same product, currency and unit dataset, for example when product has a lot of item code, then it will load many time for each SELECT. therefore I want to share the option dataset to load one for many times. if the select warp UL can reuse in other select like element it can save many loading times

Thanks for your follow my question

example screen capture


Krzysztof Wilk staff answered 4 years ago


Hi!

The goal you want to achieve is unachievable. If you have many selects with the same value I suggest using one or using Multiselect with the option groups. You can find it here https://mdbootstrap.com/docs/b4/jquery/forms/multiselect/#v-8 :)

Best regards


leejoo71 free answered 4 years ago


Yes, I forgot publish it, now below is update link

https://mdbootstrap.com/snippets/jquery/leejoo71/2838791#html-tab-view


leejoo71 free answered 4 years ago


Thanks for you answer, Yes, I tried the data-select-id, but it didn't work

https://mdbootstrap.com/snippets/jquery/leejoo71/2836942#html-tab-view


Krzysztof Wilk staff commented 4 years ago

Hi!

I have a 404 error when I am trying to open your snippet. Did you publish it?

You can also define custom select ids and use the jQuery $( document ).ready() function to change the target of the second one. But as I said above - it can be buggy.

Best regards


Krzysztof Wilk staff answered 4 years ago


Hi!

I think you can use data-select-id to define a custom ID for your select, but there is no way to use it in the other UL element. This approach will need two elements with the same ID, which can cause some bugs.

Best regards



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.19.2
  • Device: desptop
  • Browser: egde
  • OS: win7
  • Provided sample code: No
  • Provided link: No