import React from 'react'; import Menu from 'rc-menu'; import Dropdown from '../dropdown'; import Icon from '../icon'; import Checkbox from '../checkbox'; let FilterMenu = React.createClass({ getInitialState() { return { selectedKeys: this.props.selectedKeys, visible: false }; }, componentWillReceiveProps(nextProps){ this.setState({ selectedKeys: nextProps.selectedKeys }); }, getDefaultProps() { return { handleFilter: function () { }, column: null }; }, setSelectedKeys: function ({selectedKeys}) { this.setState({ selectedKeys }); }, handleClearFilters() { this.setState({ selectedKeys: [] }, this.handleConfirm); }, handleConfirm() { this.setState({ visible: false }); this.props.confirmFilter(this.props.column, this.state.selectedKeys); }, onVisibleChange(visible) { this.setState({ visible: visible }); if (!visible) { this.props.confirmFilter(this.props.column, this.state.selectedKeys); } }, renderMenus(items) { let menuItems = items.map((item) => { return = 0} /> {item.text} ; }); return menuItems; }, render() { let {column, locale} = this.props; // default multiple selection in filter dropdown let multiple = true; if ('filterMultiple' in column) { multiple = column.filterMultiple; } let menus =
{this.renderMenus(column.filters)}
{locale.filterConfirm} {locale.filterReset}
; let dropdownSelectedClass = ''; if (this.props.selectedKeys.length > 0) { dropdownSelectedClass = 'ant-table-filter-selected'; } return ; } }); export default FilterMenu;