diff --git a/components/table/SelectionCheckboxAll.tsx b/components/table/SelectionCheckboxAll.tsx index da7c802472..aeb6bee01d 100644 --- a/components/table/SelectionCheckboxAll.tsx +++ b/components/table/SelectionCheckboxAll.tsx @@ -22,6 +22,7 @@ export interface SelectionCheckboxAllProps { prefixCls: string | undefined; onSelect: (key: string, index: number, selectFunc: any) => void; selections?: SelectionDecorator[] | boolean; + getPopupContainer: (triggerNode?: Element) => HTMLElement; } export default class SelectionCheckboxAll extends React.Component { @@ -152,7 +153,7 @@ export default class SelectionCheckboxAll extends React.Component trigger.parentNode as HTMLElement} + getPopupContainer={getPopupContainer} >
diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 2941c5307b..215d2a48c3 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -143,6 +143,7 @@ export default class Table extends React.Component, any> { CheckboxPropsCache: Object; store: Store; columns: ColumnProps[]; + tableWrapperNode: HTMLElement; constructor(props) { super(props); @@ -615,6 +616,10 @@ export default class Table extends React.Component, any> { return recordKey === undefined ? index : recordKey; } + getPopupContainer = () => { + return this.tableWrapperNode as HTMLElement; + } + renderRowSelection() { const { prefixCls, rowSelection } = this.props; const columns = this.columns.concat(); @@ -646,6 +651,7 @@ export default class Table extends React.Component, any> { prefixCls={prefixCls} onSelect={this.handleSelectRow} selections={rowSelection.selections} + getPopupContainer={this.getPopupContainer} /> ); } @@ -700,6 +706,7 @@ export default class Table extends React.Component, any> { confirmFilter={this.handleFilter} prefixCls={`${prefixCls}-filter`} dropdownPrefixCls={dropdownPrefixCls || 'ant-dropdown'} + getPopupContainer={this.getPopupContainer} /> ); } @@ -939,7 +946,11 @@ export default class Table extends React.Component, any> { } return ( -
+
{ this.tableWrapperNode = node; }} + > any; prefixCls: string; dropdownPrefixCls: string; + getPopupContainer: (triggerNode?: Element) => HTMLElement; } export default class FilterMenu extends React.Component { @@ -182,7 +183,7 @@ export default class FilterMenu extends React.Component { }) : ; } render() { - const { column, locale, prefixCls, dropdownPrefixCls } = this.props; + const { column, locale, prefixCls, dropdownPrefixCls, getPopupContainer } = this.props; // default multiple selection in filter dropdown const multiple = ('filterMultiple' in column) ? column.filterMultiple : true; const dropdownMenuClass = classNames({ @@ -228,7 +229,7 @@ export default class FilterMenu extends React.Component { overlay={menus} visible={this.neverShown ? false : this.state.visible} onVisibleChange={this.onVisibleChange} - getPopupContainer={triggerNode => triggerNode.parentNode as HTMLElement} + getPopupContainer={getPopupContainer} > {this.renderFilterIcon()}