From 1c24afb35678e01a00ad989e54212747c43a0fd2 Mon Sep 17 00:00:00 2001 From: ashit-rath <88306433+ashit-rath@users.noreply.github.com> Date: Thu, 16 Sep 2021 12:26:52 +0530 Subject: [PATCH] fix: table row cell actions to get proper currentRow data (#7244) * fix: table row cell actions to get proper currentRow data * minor change --- app/client/src/widgets/TableWidget/widget/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/client/src/widgets/TableWidget/widget/index.tsx b/app/client/src/widgets/TableWidget/widget/index.tsx index 77b8c88458..da6f3308ed 100644 --- a/app/client/src/widgets/TableWidget/widget/index.tsx +++ b/app/client/src/widgets/TableWidget/widget/index.tsx @@ -232,14 +232,17 @@ class TableWidget extends BaseWidget { }, 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,