Topic: Datatable cell wrapping

RossK1 priority asked 8 months ago


Hello, I am creating a datatable with 8 columns. Two of these columns have strings of ~40 characters. I need be able to show the full string by wrapping the text within the cell.

Expected behavior With a column width define, the cell text is wrapped to fit. Where it wraps (between words, on whitespace, hard character split) is not particularly important for this application, but wrapping on whitespace would be nice. I have tried manually wrapping by inserting
at appropriate locations in the string. This does cause the text to wrap, but it is still being truncated.

Actual behavior Text outside the column width (or perhaps with some preset constant) is truncated with "..." on the end.

Resources (screenshots, code snippets etc.) The example on the website will work fine for demonstration, So take the table here, I would like the entire message to be displayed as wrapped text.


Michał Duszak staff answered 8 months ago


Try to add this in your styles:

.datatable table td, .datatable table th {
    text-overflow: unset;
    max-width: unset;
}

RossK1 priority commented 8 months ago

Works perfectly, thank you :) I have another function that parses the strings and inserts
tags in the appropriate whitespace to cleanly wrap the cell. Might be an idea for another option ... like "fixed", if a "width" is defined, one can specify "wrap" that will wrap the cell contents.


Grzegorz Bujański staff commented 7 months ago

We will consider adding such an option.



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: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.1
  • Device: PC
  • Browser: Chrome 100
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes