PermaLink XPages tip: Programmatically jumping to a page on a View or Pager control02/24/2010 07:30 AM
Domino 8.5 - XPages
In the Dynamic View Custom Control I built, and is available on OpenNTF, I noticed that the pager control does not reset when I switch datasources.  The Pager control does not reset because the custom control is not reloaded in the demo I put together.  So I was looking for a way to reset the control programmatically and I came across this article from Matt White on the XPagesblog and then also came across the same answer on IQJam (both are great resources!).

The article shows you how to get a class in JS in the Designer so that you can browse the methods that are available to you.  So for example if you want to jump to a certain page for a View control or Pager control you can use this "gotoPage()" method.

For a Pager:
var pager:com.ibm.xsp.component.xp.XspPager = getComponent("pager1");
pager.gotoPage(1);  //0 is first page etc.,.

For a View:
var view1:com.ibm.xsp.component.xp.XspViewPanel=getComponent("viewPanel2");
view1.gotoPage(1);

Here's a screen shot of the script editor and some of the methods available for a View control.  As you can see there is also gotoFirstPage(), gotoLastPage(), gotoNextPage(), gotoPreviousPage(), and gotoRow().

Image:John's Blog - XPages tip: Programmatically jumping to a page on a View or Pager control


-John

Technorati:
This page has been accessed 7058 times. .
Comments :v

1. Steve Smillie02/24/2010 11:37:18 AM


Great find!

I posted something on the Domino 8.5 forum, not too long ago, looking for a solution like this. I need to reset the view/pager to the first page when the filtering changed.




2. Steve Smillie02/25/2010 07:44:54 AM


Do you know where i can find the current page?
How about the number of pages available?

I went through the list of methods and didn't see anything.




3. Pooja04/19/2010 02:30:01 AM
Homepage: http://hiii


hiiii
its really nice of u.u helped me alot.cn u pls tell me how to create response document and how to link it to parent document.all the properties of it.m stuck dere.

Thanku




4. Viewer05/11/2010 05:50:10 AM


Hello,

Great article, thank you.

The only remaining question is, how to handle categorized views: e.g. on the first page I open three categories, then I open a document from the third opened category, which moved to the second page of the view by opening the categories. Closing the opened document takes back to the first page of the view instead of the second, because opened categories have not been stored.
I could not find any way to store the categories opened by the user, to make possible navigate back exactly the same position (view row) from the document was opened, with the categories opened. This currently works only in standard Notes client, unfortunately.
Opening Xpages documents in new window can be an option, however this method can not be applied to Notes client.
How to use gotoRow()? Totally agre with this question. From where should we get the parameter in this situation? By opening and closing categories the row number of the document always change.




5. matthew fox05/11/2010 10:40:46 AM


gotoPage only seems to work if the page you are going to is a link on the pager. e.g. if the pager shows pages 1-8, gotoPage(10) will go to page 8.

I think you can find the current page from the pager.

e.g.
pager: com.ibm.xsp.component.xp.XspPager
repeat: com.ibm.xsp.component.xp.XspDataIterator




6. Thomas Adrian11/11/2010 06:16:14 AM
Homepage: http://www.notessidan.se


I am currently working on a view that display first 30 rows, if the user click "more posts" 1-60 is displayed, and the user can continue to click "more posts" until the end is reached.

the real challange here is to not touch/reload the previous rows when feteching new ones.

Wish me luck
Thomas Adrian
{ Link }





7. Martin Cole11/18/2010 05:03:58 PM


Probably, it's just 8.5 but i'm getting a null on pager after getComponent("pager1"). Does anyone experience the same error?




8. vayasin11/29/2010 03:28:24 AM


Hello John,
i have started using xpages in a production environment ( web users not notes client ). but after running two weeks the server crashes with "out of memory" errors.
after some digging i found that the JVM memory usage was maxing out. this behavior is the same on all our domino servers all (8.5.2).
also i found this APAR on the ibm website with the same problem { Link }
do you also experience this problem? and if so how do you handle this behavior?




9. Karthick03/24/2011 07:02:31 AM
Homepage: http://ozinisle.blogspot.com


Hi John,

Please help me with the following. I understand that clicking on the page numbers in a pager present in a XPage view control triggers a full page refresh.

Is it possible to make it partial or confine the refresh to a panel that contains the view control.If yes please let me know that.

Thanks in advance :)




10. Mark Maden04/19/2011 08:42:46 AM


@7 Yes Martin, I have the same, the Action is driven from an 'onchange' event of a Radio Group.

I am sure it is something simple but does anyone have any suggestions.

I just need to reset the pager to the First Page every time the filter is changed by the Radio Group.

Thanks.

Mark




Search
Partner with us
Need help on your XPages projects?

Talk to the experts! Read more...
XPage Examples
By Category
About Me
Downloads
My Links
Monthly Archive
Powered by
Blogsphere
Lotus Domino ND7 RSS News Feed RSS Comments Feed Geo URL netcraft RSS Validator Lotus Geek Chris. A. Brandlehner OpenNTF BlogSphere