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
Related
I want to display count of no of items fetched per page using pagination like
Displaying 10 items
Although limit is set to pagination to 20 but It will not always fetch 20 items when there are only 15 items or 10 items or 25 items.
In these cases it will either have one page result for items count 15 and 10 or two pages result for items count 25.
I want to print the no of items showing on each page. Like for total items 25.
It will show Displaying 20 items on first page and Displaying 5 items on second page.
How is it possible in CakePHP 3.2 ?
This is how I get it working in CakePHP 3.2
There are two ways you can do it.
Using Helpers
create a file paginator-counter.php in /config directory with your tokens and string and add a line in /src/view/AppView.php
public function initialize()
{
$this->loadHelper('Paginator', ['templates' => 'paginator-counter']);
}
This will load the file located at config/paginator-templates.php
And then use it in your view.
For more : http://book.cakephp.org/3.0/en/views/helpers/paginator.html
Using direct string
Just print in view where you want to print the counter
<?= $this->Paginator->counter('Showing {{current}} results out of {{count}}') ?>
More tokens can be found Here : http://book.cakephp.org/3.0/en/views/helpers/paginator.html#creating-a-page-counter
I'm using 2nd way to print counter ie., using sting directly
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 can't seem to work this out. I want to display a list that starts with a specific position in an arraycollection, without changing the array. The goal is to have a set of full screen images that the user can swipe through (like in an ebook), and for the chapter index i want to start with a specific indexnumber in the arraycollection.
Is there a simple way to tell the Itemrenderer to start at a specific indexnumber in the arraycollection.
My code that starts at index 0:
<s:List id="pagedList"
width="100%" height="100%"
verticalScrollPolicy="off" horizontalScrollPolicy="on"
pageScrollingEnabled="true">
<s:layout>
<s:TileLayout orientation="rows" requestedRowCount="1"
columnWidth="{pagedList.width}" rowHeight="{pagedList.height}"
verticalGap="0" horizontalGap="0"/>
</s:layout>
<s:ArrayCollection id="contentData">
<s:Image source="assets/cover.jpg"/>
<s:Image source="assets/introduction.jpg"/>
<s:Image source="assets/H1/40_days.jpg"/>
</s:ArrayCollection>
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<s:Group>
<s:Image source="{data.source}" horizontalAlign="center"/>
</s:Group>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>
AFAIK there is no way to do this. You'll have to sort the dataprovider so that it matches the order in which you want to display the items.
If you don't want to modify the original collection, you can create a ListCollectionView, pass in the original collection to the constructor and add a sort to the ListCollectionView. You can then assign the collection view as the dataprovider of your list.
It all starts with your data. The data itself will need to contain info about a chapter offset. Typically you will store a collection of the offset seek points.
For example:
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Chapters: 1 2 3 4 5
A chapter object will hold a reference to which page to start from and its total length. A set of seek buttons will iterate through a chapter collection, telling your list to start from the appropriate offset (ie chapter 2, starts on index 4 and is 4 items long).
Your page objects can either be a single image, or a collection of images per page. In either case, what you're really building from a data point of view is a hierarchical collection.
if your goal is to show a particular image first why not set the selectedIndex for the List itself. I mean give u'r dataobjects in the dataprovider some id and pass on the index to the list.
hope this help, let me know if this is not what is intended
Might the ensureIndexIsVisible method on the Spark List work?
Note: You may need to click the "Products" checkbox at the top of the following html page to actually see this method.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/List.html#ensureIndexIsVisible()
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.
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