简体   繁体   中英

Disable table pagination in Material-UI

I use TablePagination component of Material-UI with React.

But this component doesn't have disabled prop.

I have a boolean loading value, which I want to use as a param to enable or disable arrows in the TablePagination .

How to achieve result like this?

I've tried to just pass disabled prop into TablePagination , but it doesn't work.

There is not a single disabled switch, but you can set the disabled prop of the inner button components like this:

<TablePagination
  SelectProps={{
    disabled: isDisabled
  }}
  backIconButtonProps={
    isDisabled
      ? {
          disabled: isDisabled
        }
      : undefined
  }
  nextIconButtonProps={
    isDisabled
      ? {
          disabled: isDisabled
        }
      : undefined
  }
  {...}
/>

Live Demo

代码沙盒演示

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM