Datatables dynamic ellipsis

Datatables dynamic ellipsis

ECEGROUPEECEGROUPE Posts: 78Questions: 29Answers: 1

Link to test case: https://live.datatables.net/qosixece/1/edit

I would like my table to always fit the page width, which is why I use ellipsis for the "Name" column due to the very long text it contains. Currently, the ellipsis is set to 40 characters. Is it possible to make it dynamic so it always uses the maximum number of characters possible for the column width without creating a scrollbar in the page or table?

Thank you in advance for your help/answer,
Mathieu.

Answers

  • allanallan Posts: 62,522Questions: 1Answers: 10,272 Site admin

    Frustratingly no, I'm not aware of a way that can work in a table at the moment. With a div it is easy, but the way the table width calculations work in the browser makes it really difficult.

    The plug-in is string length based - nothing clever with the widths.

    I've put this little example together to play around with the div approach a bit, but the table just expands to allow the string. We can set a max-width on the div, but then it doesn't expand to fix when the table is wider.

    I'd love for there to be a solution to this, and maybe there is that I'm just not yet aware of.

    Allan

Sign In or Register to comment.