Topic: Cannot set default value of MDBSelect

kamora free asked 1 year ago


Expected behavior

Should be able to set default value of select component

Actual behavior

There's no way to set default value of MDBSelect.

I've used MDBVue and be able to set selected prop to true for default value of select component but when it comes to MDBReact, I see no way or no workarounds to achieve the same thing. Is there nothing I can do? It's urgent because I have a task to implement the select component with default value returned from api.

Code


kamora free commented 1 year ago

const data = [ { text: "One", value: 1 }, { text: "Two", value: 2 }, { text: "Three", value: 3 }, { text: "Four", value: 4, defaultSelected: true } ]

So, it's defaulSelected, not selected. I didn't read the docs thoroughly.



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: MDB5 5.0.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Linux
  • Provided sample code: No
  • Provided link: No