Horizontal scroll and table striping do not work in Datatabl


Topic: Horizontal scroll and table striping do not work in Datatable

DashMarketingGroup pro premium priority asked a year ago

I am using an asynchronous method to fill a datatable, which I don't think should have anything to do with table formatting or scrolling, but I can't be sure. I have the following HTML to create my datatable:

    <div class="py-2">
        <div id="datatable" class="table-hover table-striped" data-mdb-loading="true" data-mdb-max-width="900"></div>
    </div>

This SHOULD give me a striped tabe with row hovering, AND when the screen width drops below 900px, the table should have horizontal scroll bars. But none of this works. The table populates as expected from the async method, but the table doesn't have striping, the hover doesn't work, and the horizontal scrollbars don't appear. What did I do wrong?


kpienkowska staff answered a year ago

I've prepared a snippet for you: https://mdbootstrap.com/snippets/standard/kpienkowska/5541597

To set styles on datatable you need to use options not classes. Refer API section in the documentation to learn more about available options.


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
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.4.1
  • Device: desktop
  • Browser: chrome
  • OS: win11
  • Provided sample code: No
  • Provided link: No