XPages: Dynamically populate Navigator Control

岁酱吖の 提交于 2019-12-11 14:56:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!