Allow indicate expandIconColumnIndex in Table, close #3055

pull/3074/head
afc163 8 years ago
parent 3d187d00a1
commit 69cdf22b42

@ -75,6 +75,7 @@ export interface TableProps {
defaultExpandedRowKeys?: string[];
expandedRowKeys?: string[];
expandIconAsCell?: boolean;
expandIconColumnIndex?: number;
onChange?: (pagination: PaginationProps | boolean, filters: string[], sorter: Object) => any;
loading?: boolean;
locale?: Object;
@ -849,13 +850,19 @@ export default class Table extends React.Component<TableProps, any> {
return newColumn;
});
let expandIconColumnIndex = (columns[0] && columns[0].key === 'selection-column') ? 1 : 0;
if ('expandIconColumnIndex' in restProps) {
expandIconColumnIndex = restProps.expandIconColumnIndex;
}
let table = (
<RcTable {...restProps}
<RcTable
{...restProps}
prefixCls={prefixCls}
data={data}
columns={columns}
className={classString}
expandIconColumnIndex={(columns[0] && columns[0].key === 'selection-column') ? 1 : 0}
expandIconColumnIndex={expandIconColumnIndex}
expandIconAsCell={expandIconAsCell}
emptyText={() => locale.emptyText}
/>

@ -30,7 +30,8 @@ const data = [
];
ReactDOM.render(
<Table columns={columns}
<Table
columns={columns}
expandedRowRender={record => <p>{record.description}</p>}
dataSource={data}
className="table"

Loading…
Cancel
Save