Antd design table dynamically changes the rowSelection problem

problem description

problems with dynamically changing rowSelection

the environmental background of the problems and what methods you have tried

In

3 cases, the official type is checkbox | radio, but there are cases where it is not needed. Dynamic changes, such as encapsulation, some are needed and some are not. If false, is passed, it will give warning (Failed prop type: Invalid prop rowSelection of type boolean supplied to Table , expected object )

.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
< Table

rowKey={reportType === 1 ? "userId":"paymentOrder"}
columns={reportType === 1 ? this.columns : columns}
dataSource={dataSouce.rows}
rowSelection={reportType === 1 ? this.rowSelection : false}

/ >

what result do you expect? What is the error message actually seen?

how to implement false without error

Feb.14,2022

Why not try undefined

Menu