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

Fix RouteLayout Pagination #995

Merged
merged 5 commits into from
Oct 26, 2023
Merged

Fix RouteLayout Pagination #995

merged 5 commits into from
Oct 26, 2023

Conversation

philip-cline
Copy link
Contributor

@philip-cline philip-cline commented Oct 17, 2023

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JSDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

Fix the pagination in the RouteLayout component, which has been the topic of some recent complaints.

Copy link
Contributor

@AdrianaCeric AdrianaCeric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pagination works great! 👍

<div>
<Pagination
bsSize='small'
// onSelect={(e) => console.log('yoyo')}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yoyo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooops!

<Pagination.Item
active={pageNum === activePage}
key={pageNum}
onClick={(e) => this._onPaginationSelect(+e.target.text)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onClick={(e) => this._onPaginationSelect(+e.target.text)}
onClick={() => this._onPaginationSelect(pageNum)}

I'm not too familiar with what +e.target.text does. Maybe this is more readable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e is just a general shorthand for the event in the event handler, which in this case is the onClick event that happens when you click on the pagination menu. We need to use that to retrieve the page number that is clicked, otherwise pageNum would pass the current page number. e.target.text is just how we can access the text (page number) that was clicked.

Copy link
Contributor

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix!

lib/manager/components/reporter/components/RouteLayout.js Outdated Show resolved Hide resolved
@philip-cline philip-cline merged commit 1295be7 into dev Oct 26, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants