Skip to content

Commit

Permalink
fix Table filter can't show after remove fixed setting. (ant-design#7962
Browse files Browse the repository at this point in the history
)

* fix Table filter can't show after remove fixed setting.
close ant-design#7909

* improve
  • Loading branch information
ddcat1115 authored Oct 22, 2017
1 parent 8e09745 commit 1281913
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions components/table/filterDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,12 @@ export default class FilterMenu extends React.Component<FilterMenuProps, any> {

componentDidMount() {
const { column } = this.props;
const rootNode = ReactDOM.findDOMNode(this);
const filterBelongToScrollBody = !!closest(rootNode, `.ant-table-scroll`);
if (filterBelongToScrollBody && column.fixed) {
// When fixed column have filters, there will be two dropdown menus
// Filter dropdown menu inside scroll body should never be shown
// To fix https://github.com/ant-design/ant-design/issues/5010
this.neverShown = true;
}
this.setNeverShown(column);
}

componentWillReceiveProps(nextProps) {
const { column } = nextProps;
this.setNeverShown(column);
const newState = {} as {
selectedKeys: string[];
visible: boolean;
Expand All @@ -77,6 +71,18 @@ export default class FilterMenu extends React.Component<FilterMenuProps, any> {
}
}

setNeverShown = (column) => {
const rootNode = ReactDOM.findDOMNode(this);
const filterBelongToScrollBody = !!closest(rootNode, `.ant-table-scroll`);
if (filterBelongToScrollBody) {
// When fixed column have filters, there will be two dropdown menus
// Filter dropdown menu inside scroll body should never be shown
// To fix https://github.com/ant-design/ant-design/issues/5010 and
// https://github.com/ant-design/ant-design/issues/7909
this.neverShown = !!column.fixed;
}
}

setSelectedKeys = ({ selectedKeys }) => {
this.setState({ selectedKeys });
}
Expand Down

0 comments on commit 1281913

Please sign in to comment.