I have a problem with this paginate in Cakephp. Please show me how to do this!
My problem is:
+ In normal: the page numbers are:
Prev 1 2 3 4 Next
When user press from 1 to 4, the page numbers are not changed.
When user press the Next button, I want the page numbers must be:
Prev 5 6 7 8 Next
But now they are:
Prev 3 4 5 6 Next
How can I move the number 5 leftmost when I press the Next button
I'm using the $this->Paginator->numbers to generate page number, how can I config this?
Please help me, thanks a lot.
You shouldn't "move" the number, but start the nav-paging call at the current page.
It is done by providing options to the numbers() function (first and last to be specific).
check it here: http://api.cakephp.org/class/paginator-helper#method-PaginatorHelpernumbers
Related
I am working with the Winforms ReportViewer and I have the following problem: I would like to modify the start index for the page number.
For example, I have 3 reports, each one consists of 2 pages.
By using the expression: "Globals!PageNumber" I will get the current page number and "Globals!TotalPages" I will get the number of pages for each report. So the result will look like this:
Report 1: Page 1 of 2, Page 2 of 2
Report 2: Page 1 of 2, Page 2 of 2
Report 3: Page 1 of 2, Page 2 of 2
However, I would like to modify this into the following:
Report 1: Page 1 of 6, Page 2 of 6
Report 2: Page 3 of 6, Page 4 of 6
Report 3: Page 5 of 6, Page 6 of 6
The expression "Globals!TotalPages" can just be replaced by a constant (in this case number 6), that's not a problem.
However, regarding the current page number, I would have to add an offset to "Globals!PageNumber", for example for report 2: "Globals!PageNumber" + 2
Unfortunately, this does not work, because the expression "Globals!PageNumber" is only evaluated once the report has been created.
Is there a possibility to add an offset to the current page number?
Thanks in advance for any advice.
You have to put a TextBox in footer/header to use an expression like this:
=Globals!PageNumber + 2
Grid doesn't fit because I need WindowScroller and they doesn't work together.
I already have 3 nodes in row for dir
but I need to have 6 nodes in row for file
dir and file can't be in the same row, instead must be whitespace (check out screen shots)
I've tried to switch 3 or 6 nodesInRow with isDir flag and track actual nodes indexed as increment after each of actual put-node-in-row but it didn't work because of reRenders that start's not from rowInd = 0
actual:
https://imgbbb.com/images/2019/04/10/Screen-Shot-2019-04-10-at-5.57.30-PMa278117232cc829d.png
expected:
https://imgbbb.com/images/2019/04/11/Screen-Shot-2019-04-11-at-1.19.57-PM.png
P.S. Sorry for direct img links ... it's because of 'You need at least 10 reputation to post images.'
This is the way how I wanted it to work
https://codesandbox.io/s/lpvn23vz7
I have an array filled with TV shows. TV shows which I have watched recently:
tvShows = ['Firefly', 'Fargo', 'Game of Thrones', 'Breaking Bad', 'The Sopranos', 'House of Cards', 'Prison Break'];
As you can see, the array contains more than 5 items. So I did this to show only 5 tv shows:
<div class="tvShow_row" *ngFor="let tvShowName of (tvShows | slice:tvShows.length - 5)">
<span class="tvShow_name">{{tvShowName}}</span>
</div>
Now, I want to have a simple button for displaying the next 5 items in the array together with my current 5 items. Obviously, the list gets longer based on the items in the array, but the principle is to show the next 5. The problem is, I don't know how to load the next 5 items from my array. Also, if I don't have 5 (because there are 7 items in the array for example), then I still want to show the rest of the array. I tried showing more items by printing the array, but then it only shows the first 5 items again, which makes sense, I guess. Does anybody know how to tackle this problem?
Maybe something like this:
*ngFor="let item of items | slice:0:[max]"
toggle(): void {
this.max = this.max + 5;
}
So setting max will show more items in the array. Without copying array and other stuff.
I'm trying to change the display of links on a search result page.This is how the links display on my page:
1 2 3 4 5 6 7 8 9 10 | Next10
1 is current page.
After clicked on Next10 link, I want it display like this:
11 12 13 14 15 16 17 18 19 20 | Next10
I 've spend hours on it. But I couldn't find the way to make it work. Is there any solution?
I use
'echo $this->Paginator->link('Next10',array('page' => $this->Paginator->params('page') + 11));'
for the view.
You're going to have to write your own paginator function to display the numbers. What you're after (and what Cake doesn't support) is a different modulus for pages before and after the displayed page. Cake only supports one modulus argument:
http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#creating-page-number-links
I want to limit the counter that is visible in pagination in cakephp? What should I do...? Currently its default showing as 1-9 as pages link. I tried limit but as it limits my post per page. I want to limit the counter not post per page. Please help me.
Modified...
I tried modulus according to answers..
I want my Pagination should be this way. If it is on first Page then.
1 2 3 ... Last
If it is on Middle of page then..
First ... 6 7 8 ... Last
If it it on last then.
First ... 11 12 13
My tried code is.
<?php echo $this->Paginator->numbers(array('modulus' => '2', 'tag' => 'span','first'=>'First','ellipsis'=>'...', 'separator' => ' ', 'last'=>'Last' )); ?>
Check out the documentation for the pagination helper: http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html
I think want you want is "modulus - how many numbers to include on either side of the current page, defaults to 8."
So in your View, you'd have something like:
// Limit numbers to 4 either side of current page
echo $this->Paginator->numbers(array('modulus' => 4));
Hope that helps.