我的数据库有一个很好的动态导航器(虽然它不是一个动态的导航器 - 我不明白它是什么)。
我加载了一些sessionScope变量。这些变量由用户在管理页面中输入数据来驱动。
用户输入应用程序(应用程序栏),标题(标题栏) - 与一个或多个应用程序绑定,最后与一个或多个标题绑定的页面。
我在页面的导航控件中使用重复,然后在描述的下方使用容器节点,然后在页面中使用另一个重复文档的类别,然后是视图的基本节点。效果很好。
我想要的是某些sessionScope.page变量有一个特殊的属性来表明它们不是文档的视图,但是在导航器中单击该页面会向用户显示一个文档,他们可以编辑或保存它
我无法弄明白该怎么做。 因此,在下面的屏幕截图中,如果用户点击了"最佳实践"它应该只是在中间窗格中打开一个文档,而不是一个带有" All"在它下面。
我认为在重复控制中这可能会更容易,但对任何建议都是开放的。
谢谢!
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:this.resources>
<xp:styleSheet href="/menus.css"></xp:styleSheet>
<xp:styleSheet href="/buttons.css"></xp:styleSheet>
</xp:this.resources>
<xp:this.beforePageLoad><![CDATA[#{javascript:sessionScope.filterContent = "All";
setTags(sessionScope.selectedPage);}]]></xp:this.beforePageLoad>
<xp:panel>
<xe:navigator id="navigator1">
<xe:this.treeNodes>
<xe:repeatTreeNode var="entry" indexVar="index">
<xe:this.value><![CDATA[#{javascript:var tmpKey:String = sessionScope.selectedTitle;
sessionScope.render[tmpKey]}]]></xe:this.value>
<xe:this.children>
<xe:basicContainerNode
submitValue="#{javascript:entry}" style="font-size:10pt">
<xe:this.label><![CDATA[#{javascript:sessionScope.descriptions[entry]}]]></xe:this.label>
<xe:this.children>
<xe:repeatTreeNode var="entry2"
indexVar="index2">
<xe:this.value><![CDATA[#{javascript:var tmpArr = [];
tmpArr.unshift("All");
tmpArr2 = @Unique(@Trim(@DbColumn(@DbName(),sessionScope.selectedPage,1)));
if (tmpArr2.length == 0)
{var tmpArr3 = tmpArr}
else
{var tmpArr3 = tmpArr.concat(tmpArr2)}
tmpArr3}]]></xe:this.value>
<xe:this.children>
<xe:basicLeafNode
label="#{javascript:entry2}"
submitValue="#{javascript:entry2}" style="font-size:8pt">
<xe:this.rendered><![CDATA[#{javascript:if (sessionScope.selectedPage == entry)
{return true}}]]></xe:this.rendered>
<xe:this.selected><![CDATA[#{javascript:if (sessionScope.filterContent == entry2)
{return true}
else
{return false}}]]></xe:this.selected>
</xe:basicLeafNode>
</xe:this.children>
</xe:repeatTreeNode>
</xe:this.children>
</xe:basicContainerNode>
</xe:this.children>
</xe:repeatTreeNode>
</xe:this.treeNodes>
<xp:eventHandler event="onItemClick" submit="true"
refreshMode="complete">
<xe:this.action><![CDATA[#{javascript:var tmpStr:String = context.getSubmittedValue();
var act:String;
if (tmpStr.substring(0,4) == "page")
{act = "page"}
if (tmpStr.substring(0,4) != "page")
{act = "cat"}
switch (act)
{
case "page":
// Do something
sessionScope.selectedPage = tmpStr;
sessionScope.filterType = "Categories";
sessionScope.filterContent = "All";
setTags(sessionScope.selectedPage);
viewScope.tag = "";
break;
case "cat":
// Do something else
sessionScope.filterType = "Categories";
sessionScope.filterContent = tmpStr;
viewScope.tag = "";
break;
default:
// Default case
break;
}
</xp:view>
答案 0 :(得分:1)
创建会话范围变量&#34;输入&#34;。它为每个条目定义了一个类型&#34; doc&#34;或&#34;查看&#34;。
根据条目的类型呈现,仅为菜单条目(在您的示例中为#34;最佳实践&#34;)或类似之前的basicContainerNode / basicLeafNode的类型为basicLeafNode。使用属性rendered
:
<xp:panel>
<xe:navigator id="navigator1">
<xe:this.treeNodes>
<xe:repeatTreeNode var="entry" indexVar="index"
value="#{javascript:sessionScope.render[sessionScope.selectedTitle]}">
<xe:this.children>
<xe:basicLeafNode
rendered="#{javascript:sessionScope.type[entry] === 'doc'}"
label="#{javascript:sessionScope.descriptions[entry]}"
submitValue="#{javascript:entry}">
</xe:basicLeafNode>
<xe:basicContainerNode
rendered="#{javascript:sessionScope.type[entry] === 'view'}"
label="#{javascript:sessionScope.descriptions[entry]}"
submitValue="#{javascript:entry}"
style="font-size:10pt">
<xe:this.children>
<xe:repeatTreeNode
var="entry2"