@ -122,6 +122,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
showHeader : true ,
sortDirections : [ 'ascend' , 'descend' ] ,
childrenColumnName : 'children' ,
tableLayout : 'auto' ,
} ;
CheckboxPropsCache : {
@ -866,6 +867,26 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
return getColumnKey ( sortColumn ) === getColumnKey ( column ) ;
}
isTableLayoutFixed() {
const { tableLayout , columns = [ ] , rowSelection , useFixedHeader , scroll = { } } = this . props ;
if ( tableLayout === 'fixed' ) {
return true ;
}
// if one column fixed, use fixed table layout to fix align issue
if ( columns . some ( ( { fixed } ) = > ! ! fixed ) ) {
return true ;
}
// if selection column fixed, use fixed table layout to fix align issue
if ( rowSelection && rowSelection . fixed ) {
return true ;
}
// if header fixed, use fixed table layout to fix align issue
if ( useFixedHeader || scroll . y ) {
return true ;
}
return false ;
}
// Get pagination, filters, sorter
prepareParamsArguments ( state : any ) : PrepareParamsArgumentsReturn < T > {
const pagination = { . . . state . pagination } ;
@ -1217,7 +1238,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
} ) = > {
const { showHeader , locale , getPopupContainer , . . . restTableProps } = this . props ;
// do not pass prop.style to rc-table, since already apply it to container div
const restProps = omit ( restTableProps , [ 'style' ] ) ;
const restProps = omit ( restTableProps , [ 'style' , 'tableLayout' ] ) ;
const data = this . getCurrentPageData ( ) ;
const expandIconAsCell = this . props . expandedRowRender && this . props . expandIconAsCell !== false ;
@ -1230,11 +1251,11 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
mergedLocale . emptyText = renderEmpty ( 'Table' ) ;
}
const classString = classNames ( {
[ ` ${ prefixCls } - ${ this . props . size } ` ] : true ,
const classString = classNames ( ` ${ prefixCls } - ${ this . props . size } ` , {
[ ` ${ prefixCls } -bordered ` ] : this . props . bordered ,
[ ` ${ prefixCls } -empty ` ] : ! data . length ,
[ ` ${ prefixCls } -without-column-header ` ] : ! showHeader ,
[ ` ${ prefixCls } -layout-fixed ` ] : this . isTableLayoutFixed ( ) ,
} ) ;
const columnsWithRowSelection = this . renderRowSelection ( {