import React from 'react'; import Menu from 'rc-menu'; var FilterMenu = React.createClass({ getInitialState() { return { selectedFilters: this.props.selectedFilters }; }, componentWillReceiveProps(nextProps){ this.setState({ selectedFilters: nextProps.selectedFilters }); }, getDefaultProps() { return { handleFilter: function () { }, column: null }; }, handleSelectFilter: function (selected) { this.setState({ selectedFilters: this.state.selectedFilters.concat(selected) }); }, handleDeselectFilter: function (key) { var index = this.state.selectedFilters.indexOf(key); if (index !== -1) { var selectedFilters = this.state.selectedFilters.concat(); selectedFilters.splice(index, 1); this.setState({ selectedFilters: selectedFilters }); } }, handleClearFilters() { this.setState({ selectedFilters: [] }); }, handleConfirm(){ this.props.confirmFilter(this.props.column, this.state.selectedFilters); }, renderMenus(items) { let menuItems = items.map((item) => { return