import React from 'react'; import Menu from 'rc-menu'; import Dropdown from '../dropdown'; import Icon from '../iconfont'; 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