Pagination disappears when you go to the last page #165

Closed
opened 2017-11-03 19:05:35 +00:00 by kevincam3 · 6 comments
kevincam3 commented 2017-11-03 19:05:35 +00:00 (Migrated from github.com)

##I added 6 items and set the view to display 5 at a time and It looks like the pagination is set for > 4 but when I'm on the second page the array has only 1 item so it doesn't display the pagination and I have no way to go back to page 1:

<?php if (isset($this->items) && rcsrankingsHelper::checkArray($this->items) && count($this->items) > 4): ?>
<form name="adminForm" method="post">
	<div class="pagination">
		<?php if ($this->params->def('show_pagination_results', 1)) : ?>
			<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> <?php echo $this->pagination->getLimitBox(); ?></p>
		<?php endif; ?>
		<?php echo $this->pagination->getPagesLinks(); ?>
	</div>

Page 1
image

Page 2
image

##I added 6 items and set the view to display 5 at a time and It looks like the pagination is set for > 4 but when I'm on the second page the array has only 1 item so it doesn't display the pagination and I have no way to go back to page 1: ``` <?php if (isset($this->items) && rcsrankingsHelper::checkArray($this->items) && count($this->items) > 4): ?> <form name="adminForm" method="post"> <div class="pagination"> <?php if ($this->params->def('show_pagination_results', 1)) : ?> <p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> <?php echo $this->pagination->getLimitBox(); ?></p> <?php endif; ?> <?php echo $this->pagination->getPagesLinks(); ?> </div> ``` Page 1 ![image](https://user-images.githubusercontent.com/870934/32391433-316c4fe6-c0b9-11e7-855f-a9d508e0b6ee.png) Page 2 ![image](https://user-images.githubusercontent.com/870934/32391233-6a596984-c0b8-11e7-8806-b8c9dc0e375a.png)
kevincam3 commented 2017-11-03 19:12:59 +00:00 (Migrated from github.com)

In the code generated

Replacing:
count($this->items) > 4

With
$this->pagination->pagesTotal > 1

Fixes it.

In the code generated Replacing: count($this->items) > 4 With $this->pagination->pagesTotal > 1 Fixes it.

Okay, thanks 👍 I will add that to the next release.

Okay, thanks :+1: I will add that to the next release.

You can update your compiler in /admin/helpers/compiler/e_Interpretation.php on line 3542 with the following.

$body[] = PHP_EOL.'<?php if (isset($this->items) && isset($this->pagination) && isset($this->pagination->pagesTotal) && $this->pagination->pagesTotal > 1): ?>';

I already added this also to the core... but will not push an update soon.

You can update your compiler in `/admin/helpers/compiler/e_Interpretation.php` on line [3542](https://github.com/vdm-io/Joomla-Component-Builder/blob/master/admin/helpers/compiler/e_Interpretation.php#L3542) with the following. ``` $body[] = PHP_EOL.'<?php if (isset($this->items) && isset($this->pagination) && isset($this->pagination->pagesTotal) && $this->pagination->pagesTotal > 1): ?>'; ``` I already added this also to the core... but will not push an update soon.
kevincam3 commented 2017-11-03 21:57:08 +00:00 (Migrated from github.com)

Thanks

Thanks
kevincam3 commented 2017-11-03 22:50:31 +00:00 (Migrated from github.com)

I found another issue with this fix I think we need to set $this->pagination->pagesTotal > 0 because the code that displays the pagination includes the code that display the $this->pagination->getLimitBox() so once I set it to display all the limit box disappears.

I guess the other option would be to move the getLimitBox call outside of the pagination call.

I found another issue with this fix I think we need to set `$this->pagination->pagesTotal > 0` because the code that displays the pagination includes the code that display the `$this->pagination->getLimitBox()` so once I set it to display all the limit box disappears. I guess the other option would be to move the getLimitBox call outside of the pagination call.

This is not ideal... the limit box is not easy to move around (since it is also dynamically movable). Let me take a closer look.. I did not investigate your fix close enough it seems.

I will get back to this a little later.

This is not ideal... the limit box is not easy to move around (since it is also dynamically movable). Let me take a closer look.. I did not investigate your fix close enough it seems. I will get back to this a little later.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#165
No description provided.