3
votes

I've spent days trying to figure this out and I give up.

I am a LotusScript programmer and have been trying to learn XPages. All of the examples and sample programs I've studied only touch on pieces of this.

Can someone explain to me step by step how to use the Selected property of the Extension Library Navigator control?

I have created my own custom control based on the layout control from the Extension Library and created a custom property called navigationPath. I also created a navigator custom control that has 5 Page Link Nodes. In the "Selected" property of each Page Link Node, I put the following SSJS:

if(compositeData.navigationPath == "/Home/ApplicationPool"){
    return true
}else{
    return false
}

/Home/ApplicationPool corresponds to the value I put in the "Selection" property of the particular Page Link Node.

In each layout custom control, I set the "navigationPath" property to compositeData.navigationPath.

What did I miss?

2

2 Answers

5
votes

there is a selected and selection property and they mean very different things and can't be used at the same time. In the code example in your question above you are using the selected property which is the wrong one in this case.

Your treeNodes in the navigator should be setup to use the selection property, this is a RegEx value that is used to see if it matches the value passed into the application layout via the custom property.

<xe:navigator id="navigator1" expandable="true" expandEffect="wipe">
  <xe:this.treeNodes>
    <xe:pageTreeNode label="nodeName" page="/page.xsp" selection="/Home/ApplicationPool" />
  </xe:this.treeNodes>
</xe:navigator>

As you can see you don't need to use any SSJS to evaluate a true/false outcome. Just match the value in the treeNode to the one in the XPage's applicationLayout control.

If your using tabs in the layout titleBar then you can set a selection property there also that uses the format /Home/.* which will make that tab highlighted for every XPage that have /Home/ at the start of it's navigationpath custom property. Don;t forget it is RegEx so any valid RegEx statement can be used here adding more power to this particular property.

2
votes

For the tree nodes in the navigator control you define the name of the xpage to open and then the related selection. Example:

<xe:pageTreeNode page="/text.xsp" selection="/Home/Test" label="Test page">
</xe:pageTreeNode>

For the individual xpages using the applicationLayout you define a value for navigationPath. If this value matches an entry in one of the tree nodes the naviagor control, then the corresponding menu item will be highlighted in the browser. The best way to define the value of the navigationPath is by using a custom property (as you are using). Here's an example of that:

<xe:applicationLayout id="applicationLayout1">
        <xe:this.configuration>
            <xe:oneuiApplication navigationPath="${javascript:compositeData.navigationPath}" ...

You can see examples of using all this in the Extension Library Teamroom and Discussion templates.

Based on my explanation on how to use it, I can see that you are not using the selection property on the navigation control correct. You just need to define a unique value for each tree node (which then will be used if it matches navigationPath on the individual xpages).

So for your specific example change your selection property to just return: "/Home/ApplicationPool"