question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Limiting amount of text visible in a column

See original GitHub issue

How can I limit the amount of text shown in a column? My form allows users to enter up to 1024 characters in a Remarks field which I can use CSS styling elsewhere on an input field to add an ellipsis (…) before overflowing (hidden). Can I do something similar with a table column?

This is what it looks like now: Screen Shot 2021-01-11 at 11 33 18 AM

This is what I’d like to do: Screen Shot 2021-01-11 at 11 34 47 AM

I use CSS like this on my input fields:

.truncate {
  width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

I don’t think the data-width attribute is sufficient, and I can’t trim the text as the field includes HTML markup and I don’t want to lose any formatting tags.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
atomkindcommented, Jan 11, 2021

Does make sense.

Just question a search enginge for CSS solutions, they are similar:

Google “css ellipsis table cell”

W3C Answer

0reactions
RossAWaddellcommented, Jan 13, 2021

If you want it always the same width, juste just width: 250px in your CSS. If you want to be sure and safe, use all you can like min-width: 250px; max-width: 250px; width: 250px;. Thats overpowered but will also work 😉 Or you want this column(s) to have a range use min-width: 100px; max-width: 250px;

If you have a CSS class for ellipse, just use the class in the header-th column where you need it. And you dont need data-width because you declare the whidth in the css class tblColEllipsis.

All table-cells in this column will have the same class: https://live.bootstrap-table.com/code/atomkind/6182

Thanks! I’ll try using a range like you suggested.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to limit characters length in a cell in Excel? - ExtendOffice
Use text to column, choose fixed width and choose the character count you want. It will separate antything above the limit to a...
Read more >
Limit Amount of Text Displayed to be the Same as the Column ...
Right Click the cells > Format Cells > Alignment tab > Horizontal drop down menu and change it from General to Fill. That...
Read more >
Excel 2007 -- limit on text displayed in a single cell?
The Column width of an Excel 2007 cell is a maximum of 255 characters but the Total number of characters that a cell...
Read more >
HTML text display Limit for table column - css - Stack Overflow
Since the word-wrap needs some block level element, you need at least to set the TD with display:inline-block .
Read more >
SQL Server - Using TEXTSIZE to limit the display Select ...
My students sometimes ask me how they might limit the amount of text displayed in large text columns, like nvarchar(max), for example.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found