我的问题跟踪应用程序有几个类别(客户端、AssignedTo、模块/类型、优先级、状态、构建等)。有几个视图具有两个分类列(EG: Client和AssignedTo、Client和Module、AssignedTo和Priority、PPriority和Client等。
我正在使用XPages移动控件实现移动页面。我想简化事情,这样移动主页上的视图选择驱动到用于选择适当的第一类别的页面,该页面反过来驱动到用于选择第二类别的页面。我不明白的是,一旦第一个类别值的选择完成,第二个类别选择页面打开,之前选择的值是什么?
到目前为止,我的示例页面如下:
<xe:singlePageApp
id="singlePageApp1"
selectedPageName="mhome">
<xe:appPage
id="appPage1"
pageName="mhome">
<xe:djxmHeading
id="djxmHeading1"
label="Home">
</xe:djxmHeading>
<xe:djxmRoundRectList
id="djxmRoundRectList1">
<xe:djxmLineItem
id="djxmLineItem1"
label="Issues by Client By Assigned To"
moveTo="selectClient1">
</xe:djxmLineItem>
<xe:djxmLineItem
id="djxmLineItem2"
label="Issues by Client By Module"
moveTo="selectClient2">
</xe:djxmLineItem>
</xe:djxmRoundRectList>
</xe:appPage>
<xe:appPage
id="appPage2"
pageName="selectClient1"
resetContent="true">
<xe:djxmHeading
id="djxmHeading2"
label="Select Client"
moveTo="mhome"
back="back">
</xe:djxmHeading>
<xp:panel>
<xp:this.data>
<xp:dominoView
var="view1"
viewName="ByClientAssignedTo">
</xp:dominoView>
</xp:this.data>
<xe:djxmRoundRectList
id="djxmRoundRectList2">
<xp:repeat
id="repeat1"
rows="30"
value="#{javascript:view1.getColumnValues(0);}"
var="client"
indexVar="clidx">
<xe:djxmLineItem
id="djxmLineItem3"
label="#{javascript:client}"
moveTo="selectAssignedTo1">
</xe:djxmLineItem>
</xp:repeat>
</xe:djxmRoundRectList>
</xp:panel>
</xe:appPage>
<xe:appPage
id="appPage3"
pageName="selectClient2"
resetContent="true">
<xe:djxmHeading
id="djxmHeading3"
label="Select Client (2)"
moveTo="mhome"
back="back">
</xe:djxmHeading>
<xp:panel>
<xp:this.data>
<xp:dominoView
var="view1"
viewName="ByClientAssignedTo">
</xp:dominoView>
</xp:this.data>
<xe:djxmRoundRectList
id="djxmRoundRectList3">
<xp:repeat
id="repeat2"
rows="30"
value="#{javascript:view1.getColumnValues(0)}"
var="client"
indexVar="clidx">
<xe:djxmLineItem
id="djxmLineItem4"
label="#{javascript:client}"
moveTo="selectType1">
</xe:djxmLineItem>
</xp:repeat>
</xe:djxmRoundRectList>
</xp:panel>
</xe:appPage>
<xe:appPage
id="appPage4"
pageName="selectAssignedTo1"
resetContent="true">
<xe:djxmHeading
id="djxmHeading4"
back="back"
label="Select Assigned To"
moveTo="selectClient1">
</xe:djxmHeading>
<xp:text
escape="true"
id="computedField1">
<xp:this.value><![CDATA[#{javascript:"What was selected on the previous page?"}]]></xp:this.value>
</xp:text>
</xe:appPage>
</xe:singlePageApp>
发布于 2013-07-02 09:23:10
技巧1:
djxmLineItem事件支持onClick事件,尽管在Xpages中没有关于它的文档(据我所知)。它被记录为dojox.mobile ListItem下的dojo的一部分。
如有必要,为另一个控件创建一个onClick事件,并将代码复制到xe:djxmLineItem标记下。您可以使用延迟求值(#)来访问indexVar,以确定重复中的哪个ListItem已被单击。
添加事件处理程序的一个主要缺点是,您必须触发目标页内部的某些内容的部分刷新,以便呈现其内容。这反过来意味着必须预加载页面内容才能使刷新目标可用。这很可能是当前移动控件实现中的一个bug,但这可能是一个痛苦的问题!
技巧2:
来跟踪页面和所选项目,而不会产生上述副作用。不要添加事件处理程序。相反的..。以这样一种方式创建列表项:将该项的"id“添加为moveTo属性的参数。
示例:
<xe:djxmRoundRectList id="menuList">
<xp:repeat value="#{compositeData.view.listItems}"
var="listItem" indexVar="menuIndex" id="listRepeat" rows="999">
<xe:djxmLineItem id="listItem"
label="#{listItem.label}" moveTo="#{compositeData.view.moveTo}&id=#{listItem.id}&clear=true"
rightText="#{listItem.rightText}">
</xe:djxmLineItem>
</xp:repeat>
</xe:djxmRoundRectList>
可以在页面底部添加以下代码,为每个appPage的转换事件添加一个事件监听器。
<xp:scriptBlock id="scriptBlock1">
<xp:this.value>
<![CDATA[XSP.addOnLoad(function(){
dijit.registry.byClass("extlib.dijit.mobile.View").forEach(function(widget, index, hash){
dojo.connect(widget, "onBeforeTransitionOut", function(moveTo, dir, transition, context, method){
var deferred = adminService.setMoveTarget(moveTo);
});
});
});
]]>
</xp:this.value>
</xp:scriptBlock>
事件处理程序正在调用一个将详细信息传递给bean的jsonRpcService (在页面转换发生之前)。
<xe:jsonRpcService id="jsonRpcService1" serviceName="adminService"
state="true">
<xe:this.methods>
<xe:remoteMethod name="setMoveTarget"
script="AdminSession.setMoveTarget(moveTo);return true;">
<xe:this.arguments>
<xe:remoteMethodArg name="moveTo"></xe:remoteMethodArg>
</xe:this.arguments>
</xe:remoteMethod>
</xe:this.methods>
</xe:jsonRpcService>
然后,AdminSession bean中的setMoveTarget()方法应该能够解析出参数来标识所选项目以及跟踪页面转换。
注意:添加clear=true是一种确保页面的pageContent仅在向前移动到页面时重置,而不是在您移回同一页面时重置的方法。
https://stackoverflow.com/questions/17412243
复制相似问题