admin管理员组文章数量:1291345
I use TablePagination ponent of Material-UI with React.
But this ponent 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.
I use TablePagination ponent of Material-UI with React.
But this ponent 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.
2 Answers
Reset to default 9There is not a single disabled
switch, but you can set the disabled
prop of the inner button ponents like this:
<TablePagination
SelectProps={{
disabled: isDisabled
}}
backIconButtonProps={
isDisabled
? {
disabled: isDisabled
}
: undefined
}
nextIconButtonProps={
isDisabled
? {
disabled: isDisabled
}
: undefined
}
{...}
/>
Live Demo
The above answer is deprecated. Instead, if you want to disable the i.e. next button you may use the structure below:
<TablePagination
slotProps={{
actions: {
nextButton: {
disabled: totalPages ? page + 1 >= totalPages : false
},
},
}}
/>
本文标签: javascriptDisable table pagination in MaterialUIStack Overflow
版权声明:本文标题:javascript - Disable table pagination in Material-UI - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741528016a2383585.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论