材料UI DataGrid垂直滚动条

问题描述 投票:0回答:2

我想在没有任何垂直滚动条的情况下渲染材料UI datagrid。这是网格的代码:

return <div style={{height: 400, width: '100%', } }>
        <DataGrid className={classes.root} rows={closedPositions} columns={columns} rowHeight={20} 
headerHeight={25} disableSelectionOnClick pageSize={20} autoPageSize={true} scrollbarSize={1}
                  components={{
                      pagination: CustomPagination,
                  }}
        />

autoPageSize的文档是:

If true, the pageSize is calculated according to the container size and the max number of rows to avoid rendering a vertical scroll bar.

我很困惑,因此为什么我有一个滚动条。即使我将DIV设置为高度10,000,桌子上没有排,但仍然有一个滚动条。 furthermore,15和1的滚动条之间没有区别(对于水平滚动条,我想要)。

没有人知道怎么了?

您尝试以下代码吗?

autoHeight={true}
reactjs material-ui
2个回答
6
投票
对我来说很好。

example.

<div style={{ width: "100%" }}>
  <DataGrid
    rows={rows}
    columns={columns}
    autoHeight={true}
  />
</div>

我认为以上答案已过时:

<DataGrid
   getRowHeight={(params) => 350 }}
/>

0
投票

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.