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的展示数据量被自动处理为pageSize #16823

Closed
1 task done
Chris-Kin opened this issue May 27, 2019 · 5 comments
Closed
1 task done

table的展示数据量被自动处理为pageSize #16823

Chris-Kin opened this issue May 27, 2019 · 5 comments
Assignees

Comments

@Chris-Kin
Copy link

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

Reproduction link

https://codepen.io/yummy/pen/WBybzZ

Steps to reproduce

数据源有13条,但是被分页的pageSize限制了只显示10条。

What is expected?

dataSource有多少数据就显示多少条,而不是由分页的参数决定。

What is actually happening?

dataSource的数据量被pageSize限制。

Environment Info
antd 3.19.1
React 16.x
System macOS
Browser chrome 74

大部分场景都是在使用真分页而不是假分页。在真分页的业务场景下,pagination的pageSize,pageNo,totalSize是由业务开发者自己决定的,组件应只负责拿到数据直接展示,如dataSource给12条就展示12条,table组件不应再结合pageSize来自主决定实际显示的数据。

成为问题的场景:
表格合并行的时候,如原始数据为:

[
  {
    a: 1,
    nestList: [
      {
        aa: 1,
        bb: 1,
      },
    ],
  },
  {
    a: 1,
    nestList: [
      {
        aa: 1,
        bb: 1,
      },
      {
        aa: 2,
        bb: 2,
      },
    ],
  },
]

最终渲染出的行数应该是array[0].nestList array[1].nestList = 3, 而不是array.length = 2。造成的结果就是后端给10条数据,实际表格可能需要展示15行数据,把展评的数据传给table时,table仅仅展示了10条。

望考虑。

@afc163
Copy link
Member

afc163 commented May 27, 2019

这不合理,那设置 pageSize 的意义是什么?

@afc163
Copy link
Member

afc163 commented May 27, 2019

如果不希望使用内建的分页功能,可以用 pagination={false} 关闭,此时会原样在单页中展示 dataSource。然后自行在 Table 外添加 Pagination 组件即可。

@afc163 afc163 closed this as completed May 27, 2019
@Chris-Kin
Copy link
Author

如果不希望使用内建的分页功能,可以用 pagination={false} 关闭,此时会原样在单页中展示 dataSource。然后自行在 Table 外添加 Pagination 组件即可。

pageSize仅用于给用户展示每页数量这个信息及用户变更每页显示条数同步至业务数据中。
一共有多少页,当前页是第几页,这两个信息应由开发者决定。
假设Table参与了总页数的计算,此时是以用户传入的为准还是以组件自己计算的为准,这个时候就可能会产生问题了。

@Bulala-liu
Copy link

啊,我也遇到这个问题了,合并行时,第一页就只展示10条,展开的3条就不展示了

@Tammeny
Copy link

Tammeny commented Feb 13, 2023

如果不希望使用内建的分页功能,可以用 pagination={false} 关闭,此时会原样在单页中展示 dataSource。然后自行在 Table 外添加 Pagination 组件即可。

pageSize仅用于给用户展示每页数量这个信息及用户变更每页显示条数同步至业务数据中。 一共有多少页,当前页是第几页,这两个信息应由开发者决定。 假设Table参与了总页数的计算,此时是以用户传入的为准还是以组件自己计算的为准,这个时候就可能会产生问题了。

+1 @afc163

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

No branches or pull requests

4 participants