【问题标题】:DataGrid - rows per page dropdown is absentDataGrid - 每页的行数下拉列表不存在
【发布时间】:2021-09-11 03:07:54
【问题描述】:

根据 DataGrid Material-UI API,rowsPerPage 下拉列表必须存在于 TableFooter 中,如官方文档中所述:

https://material-ui.com/components/data-grid/pagination/#page-size 但是当我在 CodeSandbox 中打开此示例时,UI 中没有此功能: https://codesandbox.io/s/f8fv5 如何在我的 DataGrid 中添加 rowsPerPage?

【问题讨论】:

    标签: reactjs datagrid material-ui


    【解决方案1】:

    您可以使用rowsPerPageOptions,如下所示

     <DataGrid
      pageSize={pageSize}
      onPageSizeChange={(newPageSize) => setPageSize(newPageSize)}
      rowsPerPageOptions={[5, 10, 20]}
      pagination
      {...data}
    />
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-14
    • 2015-08-22
    • 1970-01-01
    • 1970-01-01
    • 2013-01-11
    • 2021-01-24
    • 2021-07-12
    • 1970-01-01
    相关资源
    最近更新 更多