ant-design/components/table/demo/fixed-header.md

50 lines
866 B
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 17
2016-08-15 07:54:01 +08:00
title:
en-US: Fixed Header
zh-CN: 固定表头
2016-03-31 09:40:55 +08:00
---
2016-01-24 15:39:34 +08:00
2016-08-15 08:07:03 +08:00
## zh-CN
2016-08-15 07:54:01 +08:00
2016-08-15 08:07:03 +08:00
方便一页内展示大量数据。
2016-08-15 07:54:01 +08:00
2016-08-15 08:07:03 +08:00
需要指定 column 的 `width` 属性,否则列头和内容可能不对齐。
2016-08-15 07:54:01 +08:00
2016-08-15 08:07:03 +08:00
## en-US
2016-08-15 07:54:01 +08:00
2016-08-15 08:07:03 +08:00
Display large amounts of data in scrollable view.
2016-01-24 15:39:34 +08:00
2016-08-15 08:07:03 +08:00
> Specify the width of each column if header and cell do not align properly.
2016-03-06 22:44:58 +08:00
2017-01-19 15:19:03 +08:00
````__react
2016-01-24 15:39:34 +08:00
import { Table } from 'antd';
const columns = [{
title: 'Name',
2016-01-24 15:39:34 +08:00
dataIndex: 'name',
width: 150,
}, {
title: 'Age',
2016-01-24 15:39:34 +08:00
dataIndex: 'age',
width: 150,
}, {
title: 'Address',
2016-01-24 15:39:34 +08:00
dataIndex: 'address',
}];
const data = [];
for (let i = 0; i < 100; i++) {
data.push({
key: i,
name: `Edward King ${i}`,
2016-01-24 15:39:34 +08:00
age: 32,
address: `London, Park Lane no. ${i}`,
2016-01-24 15:39:34 +08:00
});
}
ReactDOM.render(
2016-03-24 17:01:41 +08:00
<Table columns={columns} dataSource={data} pagination={{ pageSize: 50 }} scroll={{ y: 240 }} />
2016-01-24 15:39:34 +08:00
, mountNode);
````