Skip to content

Commit

Permalink
add props isEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
wdh2100 committed Feb 20, 2022
1 parent b8a6059 commit 940fee7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/components/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,18 @@ class TableBody extends React.Component {
print={columns[column.index].print}
options={options}
tableId={tableId}
isEmpty={false}
key={column.index}>
{column.value}
</TableBodyCell>
),
)}
</TableBodyRow>
{this.isRowExpanded(dataIndex) && options.renderExpandableRow(row, { rowIndex, dataIndex })}
{this.isRowExpanded(dataIndex) &&
options.renderExpandableRow(row, {
rowIndex,
dataIndex,
})}
</React.Fragment>
);
})
Expand Down
9 changes: 6 additions & 3 deletions src/components/TableBodyCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const useStyles = makeStyles(
display: 'inline-block',
fontSize: '16px',
height: 'auto',
width: props=>props.isEmpty?'calc(100%)':'calc(50%)',
width: props => (props.isEmpty ? 'calc(100%)' : 'calc(50%)'),
boxSizing: 'border-box',
'&:last-child': {
borderBottom: 'none',
Expand Down Expand Up @@ -107,6 +107,7 @@ function TableBodyCell(props) {
tableId,
...otherProps
} = props;
console.log(props);
const onCellClick = options.onCellClick;

const handleClick = useCallback(
Expand Down Expand Up @@ -169,10 +170,12 @@ function TableBodyCell(props) {
{typeof children === 'function' ? children(dataIndex, rowIndex) : children}
</div>,
];

console.log('isEmty' + props.isEmpty);
var innerCells;
if (
['standard', 'scrollMaxHeight', 'scrollFullHeight', 'scrollFullHeightFullWidth'].indexOf(options.responsive) !== -1||props.isEmpty
['standard', 'scrollMaxHeight', 'scrollFullHeight', 'scrollFullHeightFullWidth'].indexOf(options.responsive) !==
-1 ||
props.isEmpty
) {
innerCells = cells.slice(1, 2);
} else {
Expand Down

0 comments on commit 940fee7

Please sign in to comment.