Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get pagination and sort parameters? #72

Open
luqin opened this issue Oct 14, 2015 · 15 comments
Open

How to get pagination and sort parameters? #72

luqin opened this issue Oct 14, 2015 · 15 comments

Comments

@luqin
Copy link
Contributor

luqin commented Oct 14, 2015

由于这个库不支持服务端分页,所以我需要获取分页和排序参数,用于自己构造服务端分页dataSource。
请问能提供这个支持吗?由于目前不能升级react0.14,因此使用的版本:

"react-bootstrap": "^0.26.2"

希望能提供接口支持,谢谢。

@luqin luqin changed the title How to get pagination and sort info paras? How to get pagination and sort parameters? Oct 14, 2015
@AllenFang
Copy link
Owner

I will think about that, maybe provide the on page changing or on sorting hook, because component is hard to open static public api. You can see my answer for #70

@luqin
Copy link
Contributor Author

luqin commented Oct 15, 2015

@AllenFang 👍

@luqin
Copy link
Contributor Author

luqin commented Oct 15, 2015

后续的接口如何设计?

@AllenFang
Copy link
Owner

Like I said, I will provide a hook (callback) for after page changing or sorting and pass these data as params, so you can get it. Currently, I've no idea for provide a public method on some class. any idea?

@luqin
Copy link
Contributor Author

luqin commented Oct 19, 2015

@AllenFang

options:{
        page: 0,  //默认显示页数
        sizePerPageList: [5,10,30,50,100], //分页选择数量
        sizePerPage: 10,  //每页分页大小数量
        paginationSize: 10  //显示分页数按钮个数
        dataTotalSize:30,    //总共数据大小

        onPageChange:handlePageChange, //分页变更事件
        onSortChange:handleSortChange //排序事件
      }

我已经实现了如上接口的功能,分页和排序变化时传入一个回调如何?

@AllenFang
Copy link
Owner

@luqin, good design. but dataTotalSize is means the remote fetching max size?

@luqin
Copy link
Contributor Author

luqin commented Oct 19, 2015

@AllenFang yes

@AllenFang
Copy link
Owner

This should be better

options:{
        page: 0,  //默认显示页数
        sizePerPageList: [5,10,30,50,100], //分页选择数量
        sizePerPage: 10,  //每页分页大小数量
        paginationSize: 10,  //显示分页数按钮个数
        fetchInfo: {
                dataTotalSize:30,    //总共数据大小
                //......
        },
        onPageChange:handlePageChange, //分页变更事件
        onSortChange:handleSortChange //排序事件
      }

@AllenFang
Copy link
Owner

@luqin I'll implement this function (get pagination and sort parameters) in these day

@luqin
Copy link
Contributor Author

luqin commented Oct 21, 2015

我已经实现了分页和排序,remote 数据 写了个demo

@luqin
Copy link
Contributor Author

luqin commented Oct 23, 2015

分页和排序这样如何?

options:{
        page: 0,  //默认显示页数
        sizePerPageList: [5,10,30,50,100], //分页选择数量
        sizePerPage: 10,  //每页分页大小数量
        paginationSize: 10,  

        onPageChange:handlePageChange, //分页变更事件
        onsizePerPageChange:handlePageChange, //每页数量变更事件
        onSortChange:handleSortChange //排序事件
      }

@AllenFang
Copy link
Owner

OK

@jflayhart
Copy link

jflayhart commented Jun 6, 2016

Is this some way to add a totalPages feature? All I need this plugin to do that it doesn't do already is set the total number of available pages to what I get back from my server. For example, if there are 50 pages of available data, then I set

options: {
  totalPages: 50
}

@AllenFang
Copy link
Owner

There's no way to do, but maybe you can try this

@EastonCodings
Copy link

pagination 请问,如何在页面加载的时候,隐藏分页button,当触发button查询事件时,再显示出来 。。。

const options = {
...config.defaultTableOptions,
page: this.props.pageInfo ? this.props.pageInfo.number : 1,
sizePerPage: this.props.pageInfo ? this.props.pageInfo.size : 10,
onPageChange: this.changePage,
sizePerPageList: [{
text: '10', value: 10
}, {
text: '20', value: 20
}, {
text: '30', value: 30
}],
paginationShowsTotal: this.showsTotal
};
return (
<BootstrapTable data={this.props.tableAllUsers}
options={options} striped hover condensed
pagination={true}
remote={true}
// checkbox
selectRow={selectRowProp}
fetchInfo={{ dataTotalSize: this.props.pageInfo ? this.props.pageInfo.totalElements : 0 }}>
......)
default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants