You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
---
|
|
|
|
order: 29
|
|
|
|
title:
|
|
|
|
en-US: ellipsis column custom tooltip
|
|
|
|
zh-CN: 自定义单元格省略提示
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
设置 `column.ellipsis.showTitle` 关闭单元格内容自动省略后默认的 `title` 提示, 使用 `Tooltip` 替代。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Ellipsis cell content via setting `column.ellipsis.showTitle`, use `Tooltip` instead of the html title attribute.
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
import { Table, Tooltip } from 'antd';
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
{
|
|
|
|
title: 'Name',
|
|
|
|
dataIndex: 'name',
|
|
|
|
key: 'name',
|
|
|
|
render: text => <a>{text}</a>,
|
|
|
|
width: 150,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Age',
|
|
|
|
dataIndex: 'age',
|
|
|
|
key: 'age',
|
|
|
|
width: 80,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Address',
|
|
|
|
dataIndex: 'address',
|
|
|
|
key: 'address 1',
|
|
|
|
ellipsis: {
|
|
|
|
showTitle: false,
|
|
|
|
},
|
|
|
|
render: address => (
|
|
|
|
<Tooltip placement="topLeft" title={address}>
|
|
|
|
{address}
|
|
|
|
</Tooltip>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Long Column Long Column Long Column',
|
|
|
|
dataIndex: 'address',
|
|
|
|
key: 'address 2',
|
|
|
|
ellipsis: {
|
|
|
|
showTitle: false,
|
|
|
|
},
|
|
|
|
render: address => (
|
|
|
|
<Tooltip placement="topLeft" title={address}>
|
|
|
|
{address}
|
|
|
|
</Tooltip>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Long Column Long Column',
|
|
|
|
dataIndex: 'address',
|
|
|
|
key: 'address 3',
|
|
|
|
ellipsis: {
|
|
|
|
showTitle: false,
|
|
|
|
},
|
|
|
|
render: address => (
|
|
|
|
<Tooltip placement="topLeft" title={address}>
|
|
|
|
{address}
|
|
|
|
</Tooltip>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Long Column',
|
|
|
|
dataIndex: 'address',
|
|
|
|
key: 'address 4',
|
|
|
|
ellipsis: {
|
|
|
|
showTitle: false,
|
|
|
|
},
|
|
|
|
render: address => (
|
|
|
|
<Tooltip placement="topLeft" title={address}>
|
|
|
|
{address}
|
|
|
|
</Tooltip>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const data = [
|
|
|
|
{
|
|
|
|
key: '1',
|
|
|
|
name: 'John Brown',
|
|
|
|
age: 32,
|
|
|
|
address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '2',
|
|
|
|
name: 'Jim Green',
|
|
|
|
age: 42,
|
|
|
|
address: 'London No. 2 Lake Park, London No. 2 Lake Park',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
name: 'Joe Black',
|
|
|
|
age: 32,
|
|
|
|
address: 'Sidney No. 1 Lake Park, Sidney No. 1 Lake Park',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export default () => <Table columns={columns} dataSource={data} />;
|
|
|
|
```
|