MDBSelect does not show search.


Topic: MDBSelect does not show search.

Malasharhan asked a year ago

Expected behavior

I want to show search in MDBSelect. My code is as follow

   <MDBSelect className="my-0" outline search searchLabel="Write here" selected={values.jobRoleId} getValue={val => {
       helpers.triggerChangeEvent("jobRoleId", val[0]) }}>
      <MDBSelectInput selected={t("COMMON.VALUES.UNDEFINED")} />
      <MDBSelectOptions>
        <MDBSelectOption disabled>{t("COMMON.VALUES.UNDEFINED")}</MDBSelectOption>
            {jobRoles.map((item, index) => (
              <MDBSelectOption key={index} value={item.id} checked={values.jobRoleId == item.id}>{item[`jobRole_${lang}`]}</MDBSelectOption>
            ))}
       </MDBSelectOptions>
   </MDBSelect>

Actual behavior

But does not show Searchbar


Jakub Chmura staff premium answered a year ago

Hi @Malasharhan,

The search bar in MDBSelect is only available when you use select with data array.

In the example above you use our select with markup.

Please check our documentation for more information:

https://mdbootstrap.com/docs/react/forms/select/

Best, Kuba


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: React
  • MDB Version: 4.25.2
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No