小编Tal*_*orr的帖子

React - Material UI:如何从表格中删除滚动条

我已经按照以下说明构建了一个带有 React 和 Material UI 的简单表格: https: //material-ui.com/components/tables/#table

它工作正常,但滚动条让我烦恼。 在此输入图像描述

是否有一个选项可以让滚动条从红色箭头开始?或者完全删除它?

先感谢您

代码

    <TableContainer component={Paper} style={{maxHeight: 350}}>
    <Table className={styles.table} size="small" stickyHeader>
      <TableHead>
        <TableRow >
          <TableCell className={styles.header}>
            <Checkbox checked={allSelected} onClick={handleSelectAll} color="primary"/>
          </TableCell>
          <TableCell className={styles.header} align="left">Name</TableCell>
          {props.showAdmin && <TableCell className={styles.header}>Admin</TableCell>}
        </TableRow>
      </TableHead>
      <TableBody>
        {props.employees.map(empl => (
          <TableRow key={empl.id}>
            <TableCell>
              <Checkbox checked={isSelected(empl.id)} onClick={() =>handleSelect(empl.id)} className={styles.checkBox} color="primary"/>
            </TableCell>
            <TableCell component="th" scope="row" style={{paddingRight: 30}}>{empl.name}</TableCell>
            {props.showAdmin && <TableCell align="center"><Checkbox disabled checked={empl.isAdmin} className={styles.checkBox}/></TableCell>}
          </TableRow>
        ))}
      </TableBody>
    </Table>
  </TableContainer>
Run Code Online (Sandbox Code Playgroud)

风格

createStyles({
  table: {
   maxWidth: 350,
   maxHeight: 300
  }, …
Run Code Online (Sandbox Code Playgroud)

html css typescript reactjs material-ui

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

css ×1

html ×1

material-ui ×1

reactjs ×1

typescript ×1