Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Technique 1:<br> The djxmLineItem event supports the onClick event event though there is no documentation for it within Xpages (that I have found). It is documented as part of dojo under the dojox.mobile ListItem.</p> <p>If necessary create an onClick event for another control and copy the code under the xe:djxmLineItem tag. You can use deferred evaluation (#) to access the indexVar to identify which ListItem inside the repeat has been clicked.</p> <p>A major drawback of adding an event handler is that you must trigger a partial refresh on something inside the target page in order to cause its content to be rendered. This in turn means that pages content must be preloaded in order for the refresh target to be available. This is most likely a bug in the current implementation of mobile controls but it can be a PAIN!.</p> <p>Technique 2:<br> To track the pages AND the selected item without the above side effects. DOn't add an event handler. Instead... create the listitem in such a way that the "id" for the item is added as a parameter for the moveTo attribute.</p> <p>example:</p> <pre><code>&lt;xe:djxmRoundRectList id="menuList"&gt; &lt;xp:repeat value="#{compositeData.view.listItems}" var="listItem" indexVar="menuIndex" id="listRepeat" rows="999"&gt; &lt;xe:djxmLineItem id="listItem" label="#{listItem.label}" moveTo="#{compositeData.view.moveTo}&amp;amp;id=#{listItem.id}&amp;amp;clear=true" rightText="#{listItem.rightText}"&gt; &lt;/xe:djxmLineItem&gt; &lt;/xp:repeat&gt; &lt;/xe:djxmRoundRectList&gt; </code></pre> <p>The following code can be added to the bottom of the page to add an event listener for the transition event of every appPage.</p> <pre><code>&lt;xp:scriptBlock id="scriptBlock1"&gt; &lt;xp:this.value&gt; &lt;![CDATA[XSP.addOnLoad(function(){ dijit.registry.byClass("extlib.dijit.mobile.View").forEach(function(widget, index, hash){ dojo.connect(widget, "onBeforeTransitionOut", function(moveTo, dir, transition, context, method){ var deferred = adminService.setMoveTarget(moveTo); }); }); }); ]]&gt; &lt;/xp:this.value&gt; &lt;/xp:scriptBlock&gt; </code></pre> <p>The event handler is calling a jsonRpcService that passes the details to a bean (before the page transition occurs).</p> <pre><code>&lt;xe:jsonRpcService id="jsonRpcService1" serviceName="adminService" state="true"&gt; &lt;xe:this.methods&gt; &lt;xe:remoteMethod name="setMoveTarget" script="AdminSession.setMoveTarget(moveTo);return true;"&gt; &lt;xe:this.arguments&gt; &lt;xe:remoteMethodArg name="moveTo"&gt;&lt;/xe:remoteMethodArg&gt; &lt;/xe:this.arguments&gt; &lt;/xe:remoteMethod&gt; &lt;/xe:this.methods&gt; &lt;/xe:jsonRpcService&gt; </code></pre> <p>the setMoveTarget() method in the AdminSession bean should then be able to parse out the parameters to identify the selected item as well as track the page transition.</p> <p>Note: adding clear=true is a way of ensuring pageContent of a page is only reset when moving forward to a page and not when you move back to the same page.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload