Add filterDropdown for Table column, close #1736

This commit is contained in:
afc163 2016-06-20 16:36:37 +08:00
parent f5c60541f3
commit d9f2b7ea32
3 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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}

View File

@ -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 | - |