Open DarrenDanielDay opened 11 months ago
I think the current behavior is as expected. If you want to achieve the behavior you describe, you should use frontEnd pagination.
I think the current behavior is as expected. If you want to achieve the behavior you describe, you should use frontEnd pagination.
But in this example, we set nzTotal
to 3
, which implies data on other pages does exist. It's reasonable to show an empty table when nzData
is an empty array but removing the nz-pagination
component makes the user unable to switch to a different page. If this is expected, do you have any example or best practice for server pagination?
There should be a fallback logic on the server if the requested page is empty.
In your example, after id 4 is deleted and a request for pageIndex: 2
is sent, the server should return something like
{
total: 3,
pageIndex: 1,
pageSize: 3,
data: [1, 2, 3 ]
}
And you should use pageIndex
from the server in the frontend after that.
Explicitly, I need this for server side pagination.
When we have total
but still nzDate:[]
for any one pagination option then do not hide pagination setup.
Reproduction link
https://stackblitz.com/edit/ng-zorro-antd-ivy-r8fnmf?file=src%2Fapp%2Fapp.component.ts
Steps to reproduce
Delete todo 4.
What is expected?
The pagination component should not be removed, and the
pageIndex
should be normalized to1
automatically by thenz-pagination
component. After thepageIndex
changed to 1, it should display 3 records in page 1.What is actually happening?
Then the
nz-pagination
component innz-table
is removed.Is the current behavior expected? Relevant code stays unchanged for 3 years.
https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/components/table/src/table/table.component.ts#L110