ant-design: Option to add ellipsis (...) to table cells, headers when content doesn't fit
What problem does this feature solve?
Right now when the table is resized and the content doesn’t fit, the text is broken and reflows to the next row, thus appearing rather bad. Adding an option to allow ellipsis sign (…) by adding text-overflow:ellipsis;
where required to appear would increase the usability IMHO.
Thanks in advance!
What does the proposed API look like?
ellipsize={true}
in column properties
IssueHunt Summary
Backers (Total: $25.00)
Become a backer now!
Or submit a pull request to get the deposits!
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
IssueHunt has been backed by the following sponsors. Become a sponsor
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 18
- Comments: 27 (9 by maintainers)
Commits related to this issue
- Add tableLayout and column.ellipsis https://github.com/ant-design/ant-design/issues/17127 https://github.com/ant-design/ant-design/issues/13825#issuecomment-449889241 https://github.com/ant-design/an... — committed to react-component/table by afc163 5 years ago
- Add tableLayout and column.ellipsis https://github.com/ant-design/ant-design/issues/17127 https://github.com/ant-design/ant-design/issues/13825#issuecomment-449889241 https://github.com/ant-design/an... — committed to react-component/table by afc163 5 years ago
- Add tableLayout and column.ellipsis https://github.com/ant-design/ant-design/issues/17127 https://github.com/ant-design/ant-design/issues/13825#issuecomment-449889241 https://github.com/ant-design/an... — committed to react-component/table by afc163 5 years ago
- :zap: support column.ellipsis close #5753 — committed to ant-design/ant-design by afc163 5 years ago
- :zap: support column.ellipsis close #5753 — committed to ant-design/ant-design by afc163 5 years ago
- :zap: support column.ellipsis close #5753 — committed to mucluck/ant-design by afc163 5 years ago
Solution:
and make sure you set
width
in your columns definitionsAnother solution changed from fix header example , consider adding it to doc. It seems that
Tooltip
need be inclued inrc-table
if you want to provide this feature in API,which is inappropriate.@afc163 I don’t get why this is closed. There is no way to set overflow to hidden from what I can tell unless you set a static width in the content. I don’t get the point of having a ‘width’ option on the column configuration if the content that I render is not bounded by this width… Any recommendations on how to set ellipsis overflow for any content beyond the width set in the column config?
In the above example
extremelyLongTextThatNeedsEllipsis
just grows theThanks
Still very interested in support for this, excited that you have opened this again @afc163. Thanks!
We should support in this way: https://github.com/ant-design/ant-design/issues/13825#issuecomment-449889241
The following works for me without specifying any specific column width (checked on Chrome and Safari):
Maybe somebody will find it as a useful case.
It is a user-side call, I don’t think we should support it, sorry.
Based on @twisger, as hooks
这是很多的需求啊,希望考虑下
Pull Request sent: #17284
though you can set ‘width’, @sbyps ,then ellipsis can show. the ‘width’ can’t change width the table td width change.
<td><div style={{width: 200, ...ellipsis}}></div></td>
it could be nice if these method can turns to api. And another question is: when columns api ellipsis={true}, the background color of tooltip will be affected by the color of the browser itself.
{ title: “Comment”, dataIndex: “comment”, width: “15%”, key: “comment”, sorter: true, render: (text, row, index) => { return ( <Tooltip title={text}> <div style={{ textOverflow: ‘ellipsis’, overflow: ‘hidden’, whiteSpace : “nowrap” }}>{text}</div> </Tooltip> ); } }
+1,希望可以提供属性支持
+1,有个属性设置最好了。
Would be interested in a solution as well.
For me the problem comes from the fact the width is set in a colgroup. It’s the only place that is aware of the width we defined, but we cannot cascade down its style to the content.