Topic: V4.7.6 Issue when Using Material Select on a multi-select with multiple pre-selected options

donaldst free asked 5 years ago


Pleae Note: This is for version 4.7.6 not 4.7.5

Expected behavior

A single Material Multi-select is Initialized with the original select "selected" options pre-selected.

Actual behavior

2 Material Multi-Selects are Initialized, the first select has the first option selected, the second select has all options selected.

Resources (screenshots, code snippets etc.)

Example select:

<select id='MaterialSelect' class="mdb-select md-form" multiple searchable="Search here..">
    <option value="" disabled>Choose your country</option>
    <option value="1">USA</option>
    <option selected value="2">Germany</option>
    <option selected value="3">France</option>
    <option selected value="4">Poland</option>
    <option value="5">Japan</option>
</select>

Example JS:

$('#MaterialSelect').materialSelect();

donaldst free commented 5 years ago

Figured out it was a timing issue when running the materialSelect() during the $(document).ready(); function. Moved the initialisation to a more appropriate timing.


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.7.5
  • Device: Desktop
  • Browser: Google Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No
Tags