Topic: Option "entriesOptions" provided type "string" but expected type "array"

vnagornyy priority asked 11 months ago

Expected behavior: data-mdb-entries-options="[25, 50, 100]" should work.

Actual behavior: It throws an error "Option "entriesOptions" provided type "string" but expected type "array"."

Resources (screenshots, code snippets etc.): Based on the documentation, this should work but it's reading data as a string instead of the data and throws an error.

Michał Duszak staff answered 11 months ago

Hello, thank you for your feedback. I will report this bug so it could be fixed in the nearest future. By the time we fix this you can pass this option via JS.

const datatableEl = document.querySelector('.datatable')
const datatable = mdb.Datatable.getInstance(datatableEl)
datatable.update({}, { entriesOptions: [25, 50, 100] })

vnagornyy priority commented 11 months ago

Thanks, @Michał Duszak. While testing this, I noticed that once you start changing "per page" dropdown the table gets a vertical scrollbar even though there is nothing to scroll. Here's a snippet with an example. Just change per page to 25 or 50 and hover over the table. You'll see scrollbar show up on hover.

Is this a bug?

Michał Duszak staff commented 11 months ago

I cannot replicate this bug. Could you provide a screenshot?

vnagornyy priority commented 11 months ago

This happens in Chrome and Firefox. The scrollbar shows up when scrolling and the mouse cursor is over the table. Here's a quick GIF of the issue:

Michał Duszak staff commented 11 months ago

Thank you for providing the GIF. It's strange, we will take a closer look at this case. For now i recommend setting the max-height if you want the datatable scroll to work properly, for example: data-mdb-max-height="920"

Or setting the display:none style for the inner datatable scrollbar, if you don't want any. Here are the snippets with this workaround:

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

  • User: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.1
  • Device: PC
  • Browser: Chrome
  • OS: Win 10
  • Provided sample code: Yes
  • Provided link: Yes