From 1688a8724b1c95b4e47415792987dbd18dd64755 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jun 2016 11:46:27 +0800 Subject: [PATCH] Use Radio in filter menu filterMultiple=false, close #1880 --- components/table/filterDropdown.jsx | 25 ++++++++++++++----------- components/table/style/index.less | 4 ++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/components/table/filterDropdown.jsx b/components/table/filterDropdown.jsx index 453c48b9c1..36166ff95d 100644 --- a/components/table/filterDropdown.jsx +++ b/components/table/filterDropdown.jsx @@ -3,6 +3,7 @@ import Menu, { SubMenu, Item as MenuItem } from 'rc-menu'; import Dropdown from '../dropdown'; import Icon from '../icon'; import Checkbox from '../checkbox'; +import Radio from '../radio'; export default class FilterMenu extends React.Component { static defaultProps = { @@ -53,9 +54,15 @@ export default class FilterMenu extends React.Component { } renderMenuItem(item) { + const { column } = this.props; + const multiple = ('filterMultiple' in column) ? column.filterMultiple : true; return ( - = 0} /> + { + multiple + ? = 0} /> + : = 0} /> + } {item.text} ); @@ -95,13 +102,11 @@ export default class FilterMenu extends React.Component { } render() { - let { column, locale } = this.props; + const { column, locale } = this.props; // default multiple selection in filter dropdown - let multiple = true; - if ('filterMultiple' in column) { - multiple = column.filterMultiple; - } - let menus = ( + const multiple = ('filterMultiple' in column) ? column.filterMultiple : true; + + const menus = (
); - let dropdownSelectedClass = ''; - if (this.props.selectedKeys.length > 0) { - dropdownSelectedClass = 'ant-table-filter-selected'; - } + const dropdownSelectedClass = (this.props.selectedKeys.length > 0) + ? 'ant-table-filter-selected' : ''; return ( label + span { + margin-left: 8px; + } + &-sub { border-radius: @border-radius-base; border: 1px solid @border-color-base;