Monday, February 24, 2014

Iterate through all the pages using Navigation Context in webcenter portal

Sometimes we might need to iterate through all the pages in the custom or default navigation model in the webcenter portal. For example in order to create the custom header in the portal template etc..

The following code will iterate through all the pages in the navigation context.

<af:forEach var="node" varStatus="vs"
items="#{navigationContext.defaultNavigationModel.listModel['startNode=/, includeStartNode=false']}">
<af:commandLink id="pt_cl1" text="#{node.title}"
actionListener="#{navigationContext.processAction}"
 <f:attribute name="node" value="#{node}"/>
 <af:showPopupBehavior popupId="menuPopup"
align="afterStart"
triggerType="mouseOver"/>
</af:commandLink>
</af:forEach>


In the items section mention the navigation model to be iterated and the startNode specifies the path from root node where the iteration should start.

No comments:

Post a Comment