material-table 和 reactjs 中自定义分页的任何示例 [英] Any Example for custom pagination in material-table and reactjs

查看:79
本文介绍了material-table 和 reactjs 中自定义分页的任何示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自定义分页的任何示例?材料表和 reactjs.我想将页面大小传递给服务器,并且需要隐藏分页中的第一个和最后一个按钮

Any Example for custom pagination? material-table and reactjs. I want to pass from and to page size to the server and need to hide the first and last button from paging

推荐答案

研究这个例子 https://material-table.com/#/docs/features/component-overriding 为了更好地理解我将展示的代码:有了这个,您可以直接访问分页组件并自行调用.

Styudy this example https://material-table.com/#/docs/features/component-overriding in order to understand better the code i will show: With this you can access directly to the pagination component and make the call by your own.

       `components={{
              Pagination: props => (
                           <TablePagination
                           {...props}
                          rowsPerPageOptions={[5, 10, 20, 30]}
                      rowsPerPage={this.state.numberRowPerPage}
                      count={this.state.totalRow}
                      page={
                        firstLoad
                          ? this.state.pageNumber
                          : this.state.pageNumber - 1
                      }
                      onChangePage={(e, page) =>
                        this.handleChangePage(page + 1)
                      }
                      onChangeRowsPerPage={event => {
                        props.onChangeRowsPerPage(event);
                        this.handleChangeRowPerPage(event.target.value);
                      }}
                    />
                  ),
                        }}`

使用相同的方式可以更改此按钮的文本,请查看此示例 https://material-table.com/#/docs/features/localization.

Using the same way you can change the text of this buttons, please check this example https://material-table.com/#/docs/features/localization.

最好的问候

这篇关于material-table 和 reactjs 中自定义分页的任何示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆