All blog posts, code samples and downloads licensed under Apache License 2.0.
Close

Pager save state - another approach

Oliver Busse on 12/21/2013 04:18:12 AM CET, filed under SSJS XSP 

I just found that post of Brad Balassaitis dealing with the Extlib's "pager save state" control. After fumbling around I found another approach to re-open the view page even if I navigated completely away and/or using the back and forth buttons of the browser.

There are a few steps:

I placed the pager save state control within the viewPanel tag (if you are using a view), set all modes to partialRefresh (as my view also does) and selected the ID of the view control. This should look something like the first code block below.

But instead of calling the SSJS as Brad mentioned I just added the line in the page's beforePageLoad event (second code block).

One disadvantage may be that the state of the view is always saved even if youo re-navigate to the whole page again. I found this a very cool thing instead as the state is saved for EVERY single view page, so you can navigate wherever you want - and the view stays the same.

<xe:pagerSaveState id="pagerSaveState1" refreshId="theView" partialRefresh="true">
</xe:pagerSaveState>

<xp:this.beforePageLoad><![CDATA[#{javascript:viewStateBean.restoreState = true;}]]></xp:this.beforePageLoad>

Tagged with xpages bean view