Topic: Enabling dynamic vertical/horizontal scrolling of datatables
ppt premium asked 2 years ago
I am wondering if it is possible to trigger the datatable scrolling behaviour based on a parent div's size. I have seen that the datatable exhibits this behaviour through use of the HTML attributes data-mdb-max-width
and data-mdb-max-height
(as documented here) although this does not seem to be able to be set dynamically.
Is there a way to cause the datatable's max size to adjust according to something dynamic such as the containing div size?
Many thanks!
Grzegorz Bujański staff answered 2 years ago
How about this solution: https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/3828746#html-tab-view
ppt premium commented 2 years ago
Works great, thanks very much for that! Would be nice to have the height adjust dynamically too, but understand if this is non-trivial.
Grzegorz Bujański staff commented 2 years ago
The solution that I presented to you adjusts the size to the size of the parent element.
In this case, it is a container that has a max-height: 200px
. So if the size of the parent element changes, the datatable should adapt to the new sizes.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Premium
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 3.10.2
- Device: Desktop
- Browser: Edge
- OS: Windows
- Provided sample code: Yes
- Provided link: Yes