当我创建分页时,当我发送ajax然后成功回调函数然后更改索引时,我想对其进行控制
我尝试使用onchange函数,然后更改当前的数字,但仍然保持当前页面不使用
表标签具有分页
-像这样
pagination={{
total: total,
pageSize: limit,
/* onChange(current) {
dispatch({
type: '@LotteryBetRecord/turning',
payload: {
post: that.getSearchParames(),
pageSize: limit,
current: current - 1
}
})
},*/
onChange:(current,limit)=>{
that.onChange.bind(this,current,limit)
},
showTotal: function () {
return `共${total}条记录`
}
}}
/>
onConfirm={() => {
dispatch({
type: 'operational/betting',
payload: {
blist: JSON.stringify(betListValue),
callback: (res) => {
if (res.error === 0) {
message.success('success')
that.search()
that.onChange(2,10)
}
}
}
})
}}
onChange(current,limit){
const {dispatch} = this.props;
dispatch({
type: '@LotteryBetRecord/turning',
payload: {
post: this.getSearchParames(),
pageSize: limit,
current: current - 1
}
})
}
答案 0 :(得分:0)
此组件在3.13.2版中存在错误。相关问题在这里; brief description。当您通过第二页时,您填充了数据源,但第二页似乎为空,并且仍然只有一页。检查较新的版本,或者您可以使用以下解决方法;
dataSource={[...Array.from({length: (current - 1) * pageSize}), ...dataSource]}