Reputation: 21709
Why does this simple navigator code not add anything to the sessionScope var in the onItemClick event?
<xe:navigator id="navigator1">
<xe:this.treeNodes>
<xe:dominoViewListTreeNode filter="All.*" submitValue="#{javascript:return viewEntry.getName()}" var="viewEntry" href="page.xsp">
<xe:this.databaseName><![CDATA[#{javascript:database.getServer() + "!!" + "path//db.nsf"}]]></xe:this.databaseName>
</xe:dominoViewListTreeNode>
</xe:this.treeNodes>
<xp:eventHandler event="onItemClick" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:sessionScope.clickedView = context.getSubmittedValue()}]]></xp:this.action>
</xp:eventHandler>
</xe:navigator>
The code is heavily inspired by XPages101 lesson 71: http://xpages101.net/xpages101/XPages101.nsf/0/4DB7580AC6931682802579A7004E74E7
As a workaround I am transferring the viewEntry.getName() as a parameter instead by using the following href:
<xe:this.href><![CDATA[#{javascript:"page.xsp?view="+viewEntry.getName();}]]></xe:this.href>
Upvotes: 1
Views: 1168
Reputation: 3757
Per,
The href attribute in the xe:dominoViewListTreeNode causes the server side event not to be executed at all. When clicking a node it just performs a HTTP GET to the selected page (page.xsp). If you remove it and redirect the user in the serverside code your sample should work:
<xe:navigator id="navigator1">
<xe:this.treeNodes>
<xe:dominoViewListTreeNode filter="All.*" submitValue="#{javascript:return viewEntry.getName()}" var="viewEntry">
<xe:this.databaseName><![CDATA[#{javascript:database.getServer() + "!!" + "path//db.nsf"}]]></xe:this.databaseName>
</xe:dominoViewListTreeNode>
</xe:this.treeNodes>
<xp:eventHandler event="onItemClick" submit="true" refreshMode="complete">
<xp:this.action>
<![CDATA[#{javascript:sessionScope.clickedView = context.getSubmittedValue();
context.redirectToPage("page");}]]>
</xp:this.action>
</xp:eventHandler>
</xe:navigator>
Another tip: using Expression Language you could shorten the formula for the submitValue attribute to:
submitValue="#{viewEntry.name}"
Upvotes: 3