Topic: Datatables - wrap row content
Jan Louw pro asked 4 years ago
Hi,
I'm working with Datatable and would like to prevent horizontal scrolling of the table when a row content is longer than the display canvas. How can you set wrapping of column data to prevent this?
I use the Datatable code from the documentation.
Regards Jan
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Resolved
Specification of the issue
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: 9.1.0
- Device: Na
- Browser: FireFox / Chrome
- OS: Ubuntu 16:04
- Provided sample code: No
- Provided link: No
Tags
Jan Louw pro commented 4 years ago
Hi,
I've added the following style to the table column that requires "wrapping", and it works:
Just not sure if this is the best solution.
Regards
Arkadiusz Idzikowski staff commented 4 years ago
Could you provide some more details so we can reproduce this problem on our end? I just added long text to every table row and it is wrapped correctly, there is no horizontal scroll (tested on Datatables example from documentation).
Jan Louw pro commented 4 years ago
Hi,
This is my code, that is inside mdb-card-body.
The last td has my workaround. Without the style, the column does not wrap, causing horizontal scrolling. I'm using FireFox 75.0.
Regards
Arkadiusz Idzikowski staff commented 4 years ago
Can you update you first post with the full html/ts code that will allow to reproduce this problem on our end? It would be much easier to find the cause of this problem and a good solution.
Jan Louw pro commented 4 years ago
Hi Arkadiusz, Apologies for only replying now.
I've re-looked at my issue, and realize that the horizontal scrolling only comes into effect when there are no 'white spaces' in column 4 of my example. The workaround style I've added effectively causes "word wrapping" of the column. Not sure if this is something MDBDataTable should be catering for. In my case, the data collected would always have white spaces, thus it's correctly presented in MDBDataTable.
Regards