Skip to content

Commit ed23a4c

Browse files
committed
datatable fixes
1 parent 7745261 commit ed23a4c

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

shesha-reactjs/src/components/reactTable/rowCell.tsx

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { FC, ReactNode, useEffect, useRef, useState, useCallback } from 'react';
1+
import React, { FC, ReactNode, useRef, useCallback } from 'react';
22
import { Cell, CellPropGetter, TableCellProps, TableHeaderProps } from 'react-table';
33
import { useStyles } from './styles/styles';
44
import { isStyledColumn } from '../dataTable/interfaces';
@@ -35,7 +35,6 @@ export const RowCell: FC<IRowCellProps> = ({ cell, preContent, row, rowIndex, ce
3535
const { key, style, ...restProps } = cell.getCellProps(cellProps);
3636
const cellRef = useRef(null);
3737
const cellParentRef = useRef(null);
38-
const [cellParentRefWidth, setcellParentRefWidth] = useState<number>();
3938

4039
let cellStyle: React.CSSProperties = useActualContextExecutionExecutor(
4140
(context) => {
@@ -63,11 +62,6 @@ export const RowCell: FC<IRowCellProps> = ({ cell, preContent, row, rowIndex, ce
6362
return false;
6463
}, []);
6564

66-
useEffect(() => {
67-
const cellParentRefRect = cellParentRef.current.getBoundingClientRect();
68-
setcellParentRefWidth(cellParentRefRect.width);
69-
}, [cellParentRef]);
70-
7165
return (
7266
<div
7367
key={key}
@@ -80,16 +74,21 @@ export const RowCell: FC<IRowCellProps> = ({ cell, preContent, row, rowIndex, ce
8074
})}
8175
>
8276
{preContent}
83-
<div
84-
ref={cellRef}
85-
className={showExpandedView && styles.shaCellParent}
86-
onMouseOver={() => {
87-
void (showExpandedView ? getCellRef(cellRef, checkOverflow()) : getCellRef(null, null));
88-
}}
89-
style={{ maxWidth: cellParentRefWidth + "px" }}>
90-
{cell.render('Cell')}
77+
{
78+
(cell.column as unknown as { columnType: string }).columnType === 'data' ?
79+
<div
80+
ref={cellRef}
81+
className={showExpandedView && styles.shaCellParent}
82+
onMouseOver={() => {
83+
void (showExpandedView ? getCellRef(cellRef, checkOverflow()) : getCellRef(null, null));
84+
}}
85+
>
86+
{cell.render('Cell')}
87+
</div>
88+
:
89+
cell.render('Cell')
90+
}
9191

92-
</div>
9392
</div>
9493
);
9594
};

shesha-reactjs/src/components/reactTable/tableRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const TableRow: FC<ISortableRowProps> = (props) => {
8585
prepareRow(row);
8686

8787
const rowId = row.original.id ?? row.id;
88-
88+
8989
return (
9090
<CrudProvider
9191
isNewObject={false}

0 commit comments

Comments
 (0)