reactjs - 如何在React-data-table中设置paginationRowsPerPageOptions ['ALL' ,'50' ,'' 100']

标签 reactjs react-native react-hooks react-data-grid react-data-table-component

Hi Everyone, I am using the React-Data-Table component for displaying the data. My react data table is working fine. But, I need to set the pagination option [All, 50,100,150]. In the React-data-table component provides the "paginationRowsPerPageOptions" property for set the value for pagination dropdown. I am set the paginationRowsPerPageOptions[50,100,150] in my project. It's working fine. When I select the 100 value from the pagination dropdown, 100 records will be displayed. But, My goal is initially, I need to add the "All" string in my pagination dropdown, While I select the "ALL" dropdown from pagination, All records need to display in my data table. How Can I do it? I attached the sample code in the code sandbox link.

我正在使用 React-Data-Table 组件。

react 数据表:

链接:https://codesandbox.io/embed/react-data-table-sandbox-ccyuu

I already added the "paginationComponentOptions={{ selectAllRowsItem: true, selectAllRowsItemText: 'ALL' }}" in my DataTable component. But, It added in my dropdown as last value. I need to add 'ALL' value initial condition.

屏幕截图:

React-Data-Table ScreenShot

最佳答案

您可以添加此 Prop 来启用所有选项。

const paginationComponentOptions = {
  selectAllRowsItem: true,
  selectAllRowsItemText: 'ALL',
};

   <DataTable
      ...
      paginationComponentOptions={paginationComponentOptions}
      ...
    />

工作示例:https://codesandbox.io/s/react-data-table-forked-d6m05?file=/src/index.js

关于reactjs - 如何在React-data-table中设置paginationRowsPerPageOptions ['ALL' ,'50' ,'' 100'],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70426048/

相关文章:

javascript - Redux 中的订阅 Redux 中订阅的奇怪行为

android - react native : Hover image onPress

reactjs - 如何在 Typescript(输入组件)中使用 React Hook Form

javascript - 如何在React Native中过滤pokemon

reactjs - prop 类型验证中出现误报

javascript - react 选择保存 Prop

react-native - 如何检测react-native中的首次启动

javascript - 当状态改变时,react-native自动打开模态

react-native - 如何检查 React Native 调试器上的钩子(Hook)

javascript - 将参数传递给 React JS 中的另一个页面