fix: table row cell actions to get proper currentRow data (#7244)

* fix: table row cell actions to get proper currentRow data

* minor change
This commit is contained in:
ashit-rath 2021-09-16 12:26:52 +05:30 committed by GitHub
parent 0354fdaa16
commit 1c24afb356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -232,14 +232,17 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
},
columnProperties: columnProperties,
Cell: (props: any) => {
let rowIndex: number = props.cell.row.index;
const rowIndex: number = props.cell.row.index;
const data = this.props.filteredTableData[rowIndex];
if (data && data.__originalIndex__) rowIndex = data.__originalIndex__;
const originalIndex = data?.__originalIndex__ || rowIndex;
// cellProperties order or size does not change when filter/sorting/grouping is applied
// on the data thus original index is need to identify the column's cell property.
const cellProperties = this.getCellProperties(
columnProperties,
rowIndex,
originalIndex,
);
if (columnProperties.columnType === "button") {
const buttonProps = {
isSelected: !!props.row.isSelected,