Topic: DataTable initialization crashes other components

uniagro premium asked 1 month 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 1 month 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 1 month ago

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


Kamila Pieńkowska staff commented 1 month ago

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


Kamila Pieńkowska staff answered 1 month ago


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


uniagro premium commented 1 month 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