Skip to content

Commit

Permalink
🍰 DataTable fix inner pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
weiq committed Jun 19, 2019
1 parent 3ba7c62 commit 90f5b78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/__mocks__/crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ export default ({fetchMock, delay, mock, toSuccess, toError}) => {
const paramMap = body.paramMap;
const deptName = paramMap.deptName;

if (deptName == 'abcd') {
return toSuccess(mock({
'currentPage': currentPage,
'showCount': body.showCount,
'totalResult': 0,
'totalPage': 0,
dataList: [],
}), 400)
}

return toSuccess(mock({
'currentPage': currentPage,
'showCount': body.showCount,
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataTable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ class DataTable extends Component {
// 分页
const paging = objectAssign(
{
total: dataItems.total,
pageSize: dataItems.pageSize,
showSizeChanger: true,
showQuickJumper: true,
showTotal: total => `共 ${total} 条`,
onShowSizeChange: this.onShowSizeChange
},
dataItems.pageSize && { pageSize: dataItems.pageSize },
dataItems.pageNum && { current: dataItems.pageNum },
dataItems.total && { total: dataItems.total },
pagination
);

Expand Down

0 comments on commit 90f5b78

Please sign in to comment.