Browse Source

fix: table UI error

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 1 month ago
parent
commit
536153b6db
1 changed files with 4 additions and 1 deletions
  1. 4 1
      client/src/components/grid/Table.tsx

+ 4 - 1
client/src/components/grid/Table.tsx

@@ -47,6 +47,8 @@ const EnhancedTable: FC<TableType> = props => {
   } = props;
   const { t: commonTrans } = useTranslation();
 
+  const hasData = rows && rows.length > 0;
+
   return (
     <TableContainer
       sx={theme => ({
@@ -62,6 +64,7 @@ const EnhancedTable: FC<TableType> = props => {
             stickyHeader
             sx={{
               minWidth: '100%',
+              height: hasData ? 'auto' : '100%',
             }}
             aria-labelledby="tableTitle"
             size="medium"
@@ -84,7 +87,7 @@ const EnhancedTable: FC<TableType> = props => {
             )}
 
             <TableBody>
-              {rows && rows.length ? (
+              {hasData ? (
                 rows.map((row, index) => {
                   const isItemSelected = isSelected(row);
                   const labelId = `enhanced-table-checkbox-${index}`;