-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
onChange方法获取分页、排序信息
<Table
dataSource={list}
columns={columns}
rowKey="companyId"
loading={loading}
scroll={{ x: 1000 }}
onChange={handleChange}
pagination={{
total: total,
current: pageNum,
showQuickJumper: true,
showSizeChanger: true,
showTotal: (total) => `共 ${total} 条`,
}}
/>
const handleChange = (pagination: TablePaginationConfig, filters: any, sorter: any) => {
const sort = sorter.order === 'ascend' ? 'ASC' : 'DESC';
this.form.current.validateFields().then((values: any) => {
this.setState({
sortList: [{ field: sorter.field ?? 'amount', sort }],
pageNum: pagination.current ?? 1,
pageSize: pagination.pageSize ?? 10
}, () => {
const { pageNum, pageSize, sortList } = this.state
const { date, companyId, companyName, bankName, type } = values
const beginDate = moment(date[0]).format('YYYY-MM-DD HH:mm:ss');
const endDate = moment(date[1]).format('YYYY-MM-DD HH:mm:ss');
this.queryList({ pageNum, pageSize, sortList, companyName, companyId, bankName, type: type && type.length ? type : undefined, beginDate, endDate });
})
})
}
console.log(pagination)
console.log(sorter)
Metadata
Metadata
Assignees
Labels
No labels