import React from 'react'; import Menu from 'rc-menu'; import Dropdown from '../dropdown'; let FilterMenu = React.createClass({ getInitialState() { return { selectedKeys: this.props.selectedKeys }; }, componentWillReceiveProps(nextProps){ this.setState({ selectedKeys: nextProps.selectedKeys }); }, getDefaultProps() { return { handleFilter: function () { }, column: null }; }, setSelectedKeys: function ({selectedKeys}) { this.setState({ selectedKeys: 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 }); }, renderMenus(items) { let menuItems = items.map((item) => { return {item.text}; }); return menuItems; }, render() { let column = this.props.column; let menus = {this.renderMenus(column.filters)} 确定 清空 ; let dropdownSelectedClass = ''; if (this.props.selectedKeys.length > 0) { dropdownSelectedClass = 'ant-table-filter-selected'; } return ; } }); export default FilterMenu;