The XPages Mobile Controls provide an easy way to mobilize Notes/Domino data. However, if you have say 3 different views that help point a user to a specific record, the "Back" button you add to your appPage that allows users to view/edit the document can only be pointed back to a specific appPage. What's the best way to create a programmable Back button taking into account the view that the user came in via.
3
votes
Messing around with Sencha Touch I had to build a back-button registry to keep track of how a user navigates through the site. I did this with client side javascript using a stack (last in first out). When someone leaves a page, add that page to the top of the stack. Then to determine where to navigate when the back button is clicked, just navigate to whatever is stored in arrayValues[0] and remove arrayValues[0] once the navigation event is complete. Doing this the back button just keeps working until they get to the site entry point which by then the stack should be empty.
– keithstric
1 Answers
8
votes
The back button on a mobile page can be computed dynamically just like any other XPage property.
Try this for example where you can set the scope to a mobile page you've navigated from to the current mobile page.
<xp:this.moveTo>
<![CDATA[#{javascript:var from = sessionScope.get(“from”); return
from;
}]]>
</xp:this.moveTo>
This is the same technique that is used in the Discussion XL and TeamRoom XL templates for their mobile apps.
To set the scope use the rendered property in the heading control for each 'view' mobile page so every time these pages are loaded or swapped to the scoped variable is set. Try the following link to get the full demo markup from OpenNTF XSnippets