Skip to content

Commit dd4bfd2

Browse files
committed
fix col ref
1 parent 0ba919e commit dd4bfd2

File tree

1 file changed

+23
-7
lines changed
  • components/dash-table/src/dash-table/components/ControlledTable

1 file changed

+23
-7
lines changed

components/dash-table/src/dash-table/components/ControlledTable/index.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,25 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
786786
});
787787
};
788788

789+
getColumnRef(rowIndex: number, colIndex: number) {
790+
if (rowIndex === 0) {
791+
if (colIndex === 0) {
792+
return this.tableRefs.r0c0;
793+
}
794+
if (colIndex === 1) {
795+
return this.tableRefs.r0c1;
796+
}
797+
}
798+
if (rowIndex == 1) {
799+
if (colIndex === 0) {
800+
return this.tableRefs.r1c0;
801+
}
802+
if (colIndex === 1) {
803+
return this.tableRefs.r1c1;
804+
}
805+
}
806+
}
807+
789808
getNextCell = (event: any, {restrictToSelection, currentCell}: any) => {
790809
const {selected_cells, viewport, visibleColumns} = this.props;
791810

@@ -1078,13 +1097,10 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
10781097
key={columnIndex}
10791098
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
10801099
// @ts-ignore
1081-
ref={
1082-
rowIndex < 2 && columnIndex < 2
1083-
? this.tableRefs[
1084-
`r${rowIndex}c${columnIndex}`
1085-
]
1086-
: undefined
1087-
}
1100+
ref={this.getColumnRef(
1101+
rowIndex,
1102+
columnIndex
1103+
)}
10881104
className={`cell cell-${rowIndex}-${columnIndex} ${c}`}
10891105
>
10901106
{g

0 commit comments

Comments
 (0)