Topic: DataTable initialization crashes other components

uniagro premium asked 4 months ago

When setting a DataTable component, if there are any other components they aren't rendered properly. For example, having a multiselect with the data-mdb-select-init attribute and a Datatable with data-mdb-datatable-init makes the Datatable works but not the select.

Expected behavior

Every element should be rendered properly.

Actual behavior

The only working element is the Datatable.

Resources (screenshots, code snippets etc.)

Kamila Pieńkowska staff answered 4 months ago

It is a bug and we will fix it ass soon as possible. Until then add this code:

const select = document.querySelector('[data-mdb-select-init]')
const instance = mdb.Select.getOrCreateInstance(select)

uniagro premium commented 4 months ago

Thank you, as a workaround I'm creating the Datatable using Javascript.

Kamila Pieńkowska staff commented 4 months ago

It will work as well. Generally if any component is not initiating on pageload this solution would work.

Kamila Pieńkowska staff answered 4 months ago

Please publish your snippet otherwise I won't be able to see it.

uniagro premium commented 4 months ago

I think it is already public, can you please try?

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

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 7.1.0
  • Device: Any
  • Browser: Chrome
  • OS: Windows/Android
  • Provided sample code: Yes
  • Provided link: Yes