Topic: Material Select and Dynamical rendered option (Is it possible to override default keyup event handler)?

budik21 free asked 4 years ago


I'd like to ask you, if it's possible to use material select with dynamical created options.

I suppose the following use case

  1. There is a simply material select component render, no options are available.
  2. A user starts to write some string
  3. There is a "keyup" event (my own) which takes the search string and asks backed to the options (some ajax call is supposed)
  4. Backend returns the JSON with data and some method renders the options and append them under the select element

There is no problem to obtain data from BE, there is no problem to transform them to the appropriate HTML code, but I have no idea how to catch a keyup event and handle it by my own way.

May I override the default keyup event hadler?

Thanks for you advice, Radek Budař


MDBootstrap staff answered 4 years ago


Hi budik21,

Material select has a way to change its structure but I need to tell you that functionality mentioned by You is not supported. You can use method material select with attribute destroy: true to restart select and re-initialize our component. You can use the editable option and add any given option this way. The documentation that explains it in depth. https://mdbootstrap.com/docs/jquery/forms/select/#updating-destroying

These are our options to modify material select after initialization. If I can help you with anything I am here for you.

Best Regards, Piotr


budik21 free commented 4 years ago

Dear Piotr, many thanks for your answer.

Unfortunately, this is not an option for my case. I am so sorry, but I am very disappointed, I have expected more from the PRO (paid) component. I am very disappointed from the depth of your documentation too. I need to find any other framework.

Regards, Radek Budař


MDBootstrap staff commented 4 years ago

This component is under heavy refactor. Watch out for upcoming releases of MDB jQuery package. Your use case may be served by our development team. Best Regards, Piotr


MDBootstrap staff commented 4 years ago

Additionally, we have an autocomplete component that let you show your users possible options from your base of choices. Check out this documentation: https://mdbootstrap.com/docs/jquery/forms/autocomplete/ Best Regards, Piotr


budik21 free commented 4 years ago

Dear Piotr, autocomplete seems to be suitable for my case, many thanks for your advice.

Regards, Radek Budař


MDBootstrap staff commented 4 years ago

I am happy to hear that! Have a nice day.


FREE CONSULTATION

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

Status

Closed

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.9
  • Device: Notebook
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No