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

"Showing 1 to 0 of 0 results" in DataList footer #279

Open
yoannfleurydev opened this issue Aug 25, 2022 · 2 comments
Open

"Showing 1 to 0 of 0 results" in DataList footer #279

yoannfleurydev opened this issue Aug 25, 2022 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest

Comments

@yoannfleurydev
Copy link
Member

yoannfleurydev commented Aug 25, 2022

Maybe we must fix the display in footer, "Showing 1 to 0 of 0 results" seems to be not good ?

Originally posted by @Jessy-BAER in #257 (comment)

@yoannfleurydev yoannfleurydev changed the title "Showing 1 to 0 of 0 results "Showing 1 to 0 of 0 results" in DataList footer Aug 25, 2022
@yoannfleurydev yoannfleurydev added bug Something isn't working good first issue Good for newcomers labels Aug 25, 2022
@Hugo-Nortier
Copy link

Hi @yoannfleurydev , in the start-ui-web/src/components/Pagination/index.tsx file, there is :

export const getPaginationInfo = ({
  page = 1,
  pageSize = 10,
  totalItems = 0,
}) => {
  const firstItemOnPage = (page - 1) * pageSize + 1;
  ...

at line 22.
So, (1-1)*10+1 = 0+1 = 1.

Due to that, it will always show "Showing 1 to 0" at least.
Am I right?

@yoannfleurydev
Copy link
Member Author

Hi @yoannfleurydev , in the start-ui-web/src/components/Pagination/index.tsx file, there is :

export const getPaginationInfo = ({
  page = 1,
  pageSize = 10,
  totalItems = 0,
}) => {
  const firstItemOnPage = (page - 1) * pageSize + 1;
  ...

at line 22. So, (1-1)*10+1 = 0+1 = 1.

Due to that, it will always show "Showing 1 to 0" at least. Am I right?

That's right, the default computation will return 1. We can probably do some check to get 0 or maybe add a skeleton while data is fetching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest
Projects
Status: Todo
Development

No branches or pull requests

2 participants