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

Table排序后页数没有回到第一页 #16978

Closed
1 task
Veigar-C opened this issue Jun 5, 2019 · 9 comments · Fixed by #17020 or #20507
Closed
1 task

Table排序后页数没有回到第一页 #16978

Veigar-C opened this issue Jun 5, 2019 · 9 comments · Fixed by #17020 or #20507

Comments

@Veigar-C
Copy link

Veigar-C commented Jun 5, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

点击下一页,然后排序

What is expected?

排序后onChange的pagination.current为 1

What is actually happening?

仍为当前页码

Environment Info
antd 3.19.2
React 16.4.1
System win10
Browser chrome
@zombieJ
Copy link
Member

zombieJ commented Jun 7, 2019

默认行为。
如果需要跳到第一页,在 onChange 里判断一下是否是排序设置一下。

@zombieJ zombieJ closed this as completed Jun 7, 2019
@Veigar-C
Copy link
Author

Veigar-C commented Jun 7, 2019

现在目前就是这样解决的,但是京东、淘宝这些哪些是筛选排序后仍在当前页面。
你认为排序后仍然是当前页这样合理吗? @zombieJ

@afc163
Copy link
Member

afc163 commented Jun 7, 2019

pagination.current = 1;

我们在 filter 的时候是回到第一页的,我感觉可以统一一下行为。

@stevenjlho
Copy link

但是这样修改只适合需要服务器端请求数据排序的情况吧,如果只需要在当前页面排序,这样就会造成onChange的时候不知道这个是否是换页操作还是排序操作了吧

@afc163
Copy link
Member

afc163 commented Dec 27, 2019

需要再考虑一下,筛选的时候回到第一页是因为内容可能变少导致当前页没有数据了,排序理论上不会出现这个现象。

afc163 added a commit that referenced this issue Dec 27, 2019
@Veigar-C
Copy link
Author

我认为可以在 Table 或 Col 加个参数,判断是否排序后重置为首页。
例如按价格排序后,数量确实不会少,但是我希望看到的价格正序或倒叙第一的。
不然我在第N页点击排序,然后还要手动切回第一页

afc163 added a commit that referenced this issue Dec 28, 2019
zombieJ pushed a commit that referenced this issue Dec 28, 2019
@fengyun2
Copy link

我认为可以在 Table 或 Col 加个参数,判断是否排序后重置为首页。
例如按价格排序后,数量确实不会少,但是我希望看到的价格正序或倒叙第一的。
不然我在第N页点击排序,然后还要手动切回第一页

如何手动切换到第一页呢?

@zlyyyy
Copy link

zlyyyy commented Apr 26, 2020

能问下现在4.0版本 只想筛选当前页数据,不回到第一页支持吗 @afc163

@Even-Lau
Copy link

Even-Lau commented Oct 29, 2021

排序时重置到第一页是比较合理的做法。但是protable组件却不支持。

如何手动重置到第一页呢? 没有看到有暴露相关API啊

这个antd pro项目还有在维护吗?感觉作者已经弃坑了啊。。。。

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