0

How can i fixed number of character in a row then shwoing three dot (Like "some text...")

Example :

|Name          |   Age   |Description    |
+-------+---------+----------------------+
|Alice         | 34      | abcderh zyz...|
+-------+---------+----------------------+ 
|Robert La...  | 34      | Sometext is...|

If you able to analyze "Sometext is..." and after is/La it is showing three dots instead of full character/String. how can do it for single as well all column.

I have try a lot on Google but still not able to find any helpful tutorials over this problem.

my Code:

$(document).ready(function() {
    $('#example').dataTable();
} );

I have tried all these link:

jQuery DataTable overflow and text-wrapping issues

jQuery DataTables issue: columns and rows not in one line

but all it did't go through my problem. please help me guys.

Community
  • 1
  • 1
Lavekush Agrawal
  • 6,040
  • 7
  • 52
  • 85

1 Answers1

2

You need text-overflow: ellipsis; or text-overflow: "..."; to be set in your css:

td{
  text-overflow: ellipsis; // this is producing "..."
  white-space: nowrap;
  overflow: hidden;
}

Or more contextual:

#example td{
  text-overflow: ellipsis; // this is producing "..."
  white-space: nowrap;
  overflow: hidden;
}

Docs for text-overflow @ MDN

Jai
  • 74,255
  • 12
  • 74
  • 103