forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: upgrade rc-table (ant-design#2958)
* feat: remove Table columns paging, close: ant-design#2883 * css: add style for table multi-header * feat: multi-header supports fitler & sorter and so on * feat: multi-heaader works with Table[scroll.y] * feat: multi-header should works with Table[scroll.x] * style: update code style to please lint
- Loading branch information
Showing
6 changed files
with
143 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
--- | ||
order: 20 | ||
title: | ||
en-US: Grouping table head | ||
zh-CN: 表头分组 | ||
--- | ||
|
||
## zh-CN | ||
|
||
`columns[n]` 可以内嵌 `children`,以渲染分组表头。 | ||
|
||
## en-US | ||
|
||
Group table head with `columns[n].children`。 | ||
|
||
```jsx | ||
import { Table } from 'antd'; | ||
|
||
const columns = [ | ||
{ | ||
title: '姓名', | ||
dataIndex: 'name', | ||
key: 'name', | ||
width: 100, | ||
fixed: 'left', | ||
filters: [{ | ||
text: '姓李的', | ||
value: '李', | ||
}, { | ||
text: '姓胡的', | ||
value: '胡', | ||
}], | ||
onFilter: (value, record) => record.name.indexOf(value) === 0, | ||
}, | ||
{ | ||
title: '其它', | ||
children: [ | ||
{ | ||
title: '年龄', | ||
dataIndex: 'age', | ||
key: 'age', | ||
width: 100, | ||
sorter: (a, b) => a.age - b.age, | ||
}, | ||
{ | ||
title: '住址', | ||
children: [ | ||
{ | ||
title: '街道', | ||
dataIndex: 'street', | ||
key: 'street', | ||
width: 200, | ||
}, | ||
{ | ||
title: '小区', | ||
children: [ | ||
{ | ||
title: '单元', | ||
dataIndex: 'building', | ||
key: 'building', | ||
width: 50, | ||
}, | ||
{ | ||
title: '门牌', | ||
dataIndex: 'number', | ||
key: 'number', | ||
width: 100, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
title: '公司', | ||
children: [ | ||
{ | ||
title: '地址', | ||
dataIndex: 'companyAddress', | ||
key: 'companyAddress', | ||
width: 200, | ||
}, | ||
{ | ||
title: '名称', | ||
dataIndex: 'companyName', | ||
key: 'companyName', | ||
width: 200, | ||
}, | ||
], | ||
}, | ||
{ | ||
title: '性别', | ||
dataIndex: 'gender', | ||
key: 'gender', | ||
width: 60, | ||
fixed: 'right', | ||
}, | ||
]; | ||
|
||
const data = []; | ||
for (let i = 0; i < 100; i++) { | ||
data.push({ | ||
key: i, | ||
name: '胡彦祖', | ||
age: Math.ceil(Math.random() * 100), | ||
street: '拱墅区和睦街道', | ||
building: 3, | ||
number: 2035, | ||
companyAddress: '西湖区湖底公园', | ||
companyName: '湖底有限公司', | ||
gender: '男', | ||
}); | ||
} | ||
|
||
ReactDOM.render( | ||
<Table | ||
columns={columns} | ||
dataSource={data} | ||
bordered size="middle" | ||
scroll={{ x: 1010, y: 240 }} | ||
/>, | ||
mountNode | ||
); | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters