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

[RFC] Add current page start and end count #91

Merged
merged 1 commit into from May 16, 2013
Merged

[RFC] Add current page start and end count #91

merged 1 commit into from May 16, 2013

Conversation

leevigraham
Copy link
Contributor

This PR adds the ability to calculate the current page start and end count.

Example (in twig):

<p>Showing {{ pagination.getCurrentPageOffsetStart }} - {{ pagination.getCurrentPageOffsetEnd }} of {{ pagination.getNbResults }} results</p>

public function getCurrentPageOffsetEnd()
{
return (true === $this->hasNextPage())
? $this->getCurrentPage() * $this->getMaxPerPage()
Copy link
Contributor

Choose a reason for hiding this comment

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

this will be wrong for the last page. you will display 11 - 20 of 16 which is quite weird

Copy link
Contributor

Choose a reason for hiding this comment

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

ah no, sorry, it is what $this->hasNextPage() is about

@stof
Copy link
Contributor

stof commented May 15, 2013

Tests should be added

This PR adds the ability to display the current page start count and end count.

Example:

`<p>Showing {{ pagination.getCurrentPageOffsetStart }} - {{ pagination.getCurrentPageOffsetEnd }} of {{ pagination.getNbResults }} results</p>`
@leevigraham
Copy link
Contributor Author

  • Added tests
  • Rebased commits
  • Simplified conditionals

ping @stof

@pablodip pablodip merged commit 20f698f into whiteoctober:master May 16, 2013
@alexschwarz89
Copy link

Should be documented. Was hard to find.

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.

None yet

4 participants