How can I make the table header fixed on top on vertical scroll in antd? I have used css like position: fixed, top: 0. But these are not working in my case
<DraggableANTGrid
dragProps={this.dragProps}
isDraggable={false}
tableProps={{
rowKey: "IndianExpImpId",
columns: finalColumns,
components: { header: { cell: ResizeableColumn } },
dataSource: rows,
onChange: this.onFilterChange,
size: "small",
scroll: { x: totalWidth + 96, y: 700 },
expandedRowRender: this.getExpandRow,
pagination: false,
rowSelection: {
selectedRowKeys: importExportIds,
onChange: this.rowSelection,
fixed: finalColumns.length > 2
}
}} />
For antd table props,
scroll={y: ...}allows you to fix your table header. However, thescrollproperty is not compatible withexpandedRowRenderproperty. You'll have to choose one of them. A possible solution is to use onlyscrollproperty, removeexpandedRowRenderand display it's content in aModalwhenever the row is clicked.