Topic: DataTable initialization crashes other components

uniagro premium asked 8 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.) https://mdbootstrap.com/snippets/standard/uniagro/5991162


Kamila Pieńkowska staff answered 7 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 7 months ago

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


Kamila Pieńkowska staff commented 7 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 7 months ago


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


uniagro premium commented 7 months ago

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



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

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