MDBSelect component not displaying the preselected option

Topic: MDBSelect component not displaying the preselected option

tundeojerinde asked 8 months ago

Expected behavior When MDBSelect is used with a pre-selected value, the provided option should be selected by default

Actual behavior It doesn't select the option supplied to it. It selects the default option (mostly the first item in the array options

Resources (screenshots, code snippets etc.)

Mikołaj Smoleński staff commented 8 months ago

How do you define the options list? Here's a correct example:

const options1 = ref([
  { text: "One", value: 1 },
  { text: "Two", value: 2 },
  { text: "Three", value: 3 },
  { text: "Four", value: 4 },
  { text: "Five", value: 5, selected: true },
  { text: "Six", value: 6 },
  { text: "Seven", value: 7 },
  { text: "Eight", value: 8 },

Keep coding,  Mikołaj from MDB

Roger Palacios commented 7 months ago

This is not obvious at all. 2 hours expended with this...

Mikołaj Smoleński staff commented 7 months ago

Actually it's described in the first section:

Keep coding,  Mikołaj from MDB

Please insert min. 20 characters.


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



Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: MDB5 1.4.0
  • Device: HP Laptop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No