diff --git a/components/table/filterMenu.jsx b/components/table/filterDropdown.jsx similarity index 74% rename from components/table/filterMenu.jsx rename to components/table/filterDropdown.jsx index 715d4cc429..5c64ce45a7 100644 --- a/components/table/filterMenu.jsx +++ b/components/table/filterDropdown.jsx @@ -1,5 +1,6 @@ import React from 'react'; import Menu from 'rc-menu'; +import Dropdown from '../dropdown'; var FilterMenu = React.createClass({ getInitialState() { @@ -29,9 +30,17 @@ var FilterMenu = React.createClass({ selectedKeys: [] }, this.handleConfirm); }, - 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}; @@ -40,7 +49,7 @@ var FilterMenu = React.createClass({ }, render() { let column = this.props.column; - return ; + + let dropdownSelectedClass = ''; + if (this.props.selectedKeys.length > 0) { + dropdownSelectedClass = 'ant-table-filter-selected'; + } + + return + + ; } }); diff --git a/components/table/index.jsx b/components/table/index.jsx index beb98b402e..e47fbf6d2f 100644 --- a/components/table/index.jsx +++ b/components/table/index.jsx @@ -1,9 +1,8 @@ import React from 'react'; import jQuery from 'jquery'; import Table from 'rc-table'; -import Dropdown from '../dropdown'; import Checkbox from '../checkbox'; -import FilterMenu from './filterMenu'; +import FilterDropdown from './filterDropdown'; import Pagination from '../pagination'; import objectAssign from 'object-assign'; import equals from 'is-equal-shallow'; @@ -272,17 +271,10 @@ var AntTable = React.createClass({ let filterDropdown, menus, sortButton; if (column.filters && column.filters.length > 0) { let colFilters = this.state.filters[key] || []; - menus = ; - let dropdownSelectedClass = ''; - if (colFilters.length > 0) { - dropdownSelectedClass = 'ant-table-filter-selected'; - } - filterDropdown = - - ; + filterDropdown = + ; } if (column.sorter) { let isSortColumn = this.isSortColumn(column);