Ant-design-pro: List pagination

Created on 27 Nov 2017  ·  6Comments  ·  Source: ant-design/ant-design-pro

I thought that List itself will handle the data to show but it seems that pagination props does not work.
https://preview.pro.ant.design/#/list/basic-list

const paginationProps = {
      showSizeChanger: true,
      showQuickJumper: true,
      pageSize: 5,
      total: 50,
};
<List
  size="large"
  rowKey="id"
  loading={loading}
  pagination={paginationProps}
  dataSource={list}
  renderItem={item => (
    <List.Item
      actions={[<a>编辑</a>, <MoreBtn />]}
    >
      <List.Item.Meta
        avatar={<Avatar src={item.logo} shape="square" size="large" />}
        title={<a href={item.href}>{item.title}</a>}
        description={item.subDescription}
      />
      <ListContent data={item} />
    </List.Item>
  )}
/>

Most helpful comment

This is a working solution. Except for the name of the function. It should be called onShowSizeChange, not onChange.

All 6 comments

it is work, but it has no logic yet.

List能否增加一个跟Table一样的pagination分页处理方法 onChange

这个List组件哪里跑出来的
https://github.com/ant-design/ant-design/tree/master/components
为啥上面的页面找不到呢

@ityao ant design 3.0
@sangxiaolong 直接用 pagination 的 props 就可以了

遇到同样的问题,现在List的文档确实没有分页的效果,通过 https://ant.design/components/pagination/#components-pagination-demo-changer 可以设置分页属性

const paginationProps = {
    showSizeChanger: true,
    showQuickJumper: true,
    pageSize: 5,
    count: 5,
    total: 50,
    current: this.state.current,
    onChange: (page, pageSize) => {
        this.setState({
            current: page,
        });
        this.props.dispatch({
            type: 'list/fetch',
            payload: {
            count: 5,
            page,
            pageSize,
            },
        });
    },
};

This is a working solution. Except for the name of the function. It should be called onShowSizeChange, not onChange.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

952425340 picture 952425340  ·  3Comments

zhuanglong picture zhuanglong  ·  3Comments

yjz1004 picture yjz1004  ·  3Comments

skyFi picture skyFi  ·  3Comments

wuyongdec picture wuyongdec  ·  3Comments