According to Ant Design's Column grouping demo, Ant Design tables are usually just called like the following - assuming you have pre-filled columns
and data
appropriately:
<Table
columns={columns}
dataSource={data}
// ... other parameters
/>
However, I stumbled upon code which uses deconstruction (const { Column, ColumnGroup } = Table;
) and inheritance (e.g. class MyTable extends Table<Interfaces.myTable>
) to allow a code like the following within the return()
function of the render()
part of a custom component
<div>
<div className="myTable">
<MyTable dataSource={myData}
locale={{ emptyText: 'No data found'}}>
<ColumnGroup title="Headline 1">
<MyColumn title="Col 1.1"
dataIndex="iName"
key="kName"
/>
</ColumnGroup>
</MyTable>
The problem is now that this does now (after update from Antd 2.10.0 to 3.23.3) no longer work:
Error TS2459 (TS) Type 'ComponentClass, "loading" | "footer" | "style" | "title" | "scroll" | "size" | "children" | "className" | "prefixCls" | "locale" | "getPopupContainer" | "onChange" | "dataSource" | ... 27 more ... | "sortDirections">, any>' has no property 'ColumnGroup' and no string index signature
I understand that this mainly because node_modules\antd\lib\table\Table.d.ts
looks now different, and does not longer contain the ColumnGroup
property. What alternatives do I have now, if I do not want to rewrite literally thousand lines of code?