Hi,
I have a standard xpages viewpanel with the usual pager, an ability for the user to select how many results to display per page, and an ability for the user to open or close all twisties (categorized view) at once.
This combination of viewpanel options can lead to a very complicated viewpanel state. For example, the user may close all twisties, then go to page two, then open one twistie, then go to page 5 and open another twistie, and then click a document under this twistie.
If the user clicks this document (to open its xpage), and then presses the document's cancel button the simple action works miraculously to return the user to where they were in that complicated configuration of twisties and pages.
<xp:this.action>
<xp:openPage name="$$PreviousPage"></xp:openPage>
</xp:this.action>
Here is my problem: In some instances, I must refresh the document xpage. This resets $$PreviousPage to the current document xpage, not the xpage with the viewpanel, so if the user selects Cancel, the simple action is no longer returning the user to that view as expected.
Before I refresh the document xpage, I would like to store the $$PreviousPage value so that I can retrieve it if the user selects Cancel. I was hoping for something like
sessionScope.put("previousPage", $$PreviousPage)
I am aware that there are other ways to store the state of a viewpanel without relying on $$PreviousPage. For instance,
var c = getComponent("viewPanel");
if (c) {
sessionScope.put("viewfirst"+view.getPageName(), c.first);
}
but just saving the page, does not take into account the state of the twisties, so it can lead to unexpected (i.e., wrong) results.
So what is $$PreviousPage? Does it belong to the database? The context? Is it an environment variable of some kind? How does one access its value via javascript and tap into its amazing ability to put my users right back where they want to be?