问题
I need to create links of available views in database on Navigator Control. I did not find any computed formula area for that control. Just like we use code for combobox:
var v = database.getViews();
var a = []
for(var i=0; i<v.size(); i++) {
a[i] = v[i].getName()
}
return a
After achieving that, the select view will display by Dynamic View Panel of ext library. Please guide me how to do this. Thanks in advance.
-MAK
回答1:
You can create a navigation entry for each view in you database using the <xe:repeatTreeNode>
in the <xe:navigator>
:
<xe:navigator id="outline" expandable="true">
<xe:this.treeNodes>
<xe:repeatTreeNode loaded="true" indexVar="index" var="crrView" value="#{javascript:return database.getViews();}">
<xe:this.children>
<xe:basicLeafNode label="#{javascript:crrView.getName();}" loaded="true">
</xe:basicLeafNode>
</xe:this.children>
</xe:repeatTreeNode>
</xe:this.treeNodes>
</xe:navigator>
This code will generate a in you navigation for each view in your Database. You can use the variable crrView
in the <xe:basicleafNode>
to get current element of the Vector returned by database.getViews()
in the loop.
You can also use other elements then the <xe:basicLeafNode>
in the <xe:repeatTreeNode>.
Select the RepeatNode in the NavigationItems window of the navigatior control and click on add Child.
来源:https://stackoverflow.com/questions/16979160/xpages-dynamically-populate-navigator-control