mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
Add filterDropdown for Table column, close #1736
This commit is contained in:
parent
f5c60541f3
commit
d9f2b7ea32
@ -563,7 +563,7 @@ export default class Table extends React.Component {
|
||||
let key = this.getColumnKey(column, i);
|
||||
let filterDropdown;
|
||||
let sortButton;
|
||||
if (column.filters && column.filters.length > 0) {
|
||||
if ((column.filters && column.filters.length > 0) || column.filterDropdown) {
|
||||
let colFilters = this.state.filters[key] || [];
|
||||
filterDropdown = (
|
||||
<FilterDropdown
|
||||
|
@ -15,7 +15,7 @@ export default class FilterMenu extends React.Component {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
selectedKeys: this.props.selectedKeys,
|
||||
selectedKeys: props.selectedKeys,
|
||||
keyPathOfSelectedItem: {}, // 记录所有有选中子菜单的祖先菜单
|
||||
visible: false,
|
||||
};
|
||||
@ -106,7 +106,7 @@ export default class FilterMenu extends React.Component {
|
||||
// default multiple selection in filter dropdown
|
||||
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true;
|
||||
|
||||
const menus = (
|
||||
const menus = column.filterDropdown ? column.filterDropdown : (
|
||||
<div className="ant-table-filter-dropdown">
|
||||
<Menu
|
||||
multiple={multiple}
|
||||
|
@ -89,6 +89,7 @@ const columns = [{
|
||||
| filters | 表头的筛选菜单项 | Array | - |
|
||||
| onFilter | 本地模式下,确定筛选的运行函数 | Function | - |
|
||||
| filterMultiple | 是否多选 | Boolean | true |
|
||||
| filterDropdown | 可以自定义筛选菜单,此函数只负责渲染图层,需要自行编写各种交互 | React.Element | - |
|
||||
| sorter | 排序函数,本地排序使用一个函数,需要服务端排序可设为 true | Function or Boolean | - |
|
||||
| colSpan | 表头列合并,设置为 0 时,不渲染 | Number | |
|
||||
| width | 列宽度 | String or Number | - |
|
||||
|
Loading…
Reference in New Issue
Block a user