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 1691 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. data recovery08/06/2010 05:02:04 AM
Homepage: http://www.datadoctor.biz


Thanks for this. It is very helpful in my project work. Currently big portion of my project is pending.




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