xpages 保存/取消操作场景 [英] xpages save / cancel actions scenario

查看:22
本文介绍了xpages 保存/取消操作场景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将简要描述我的小项目应用程序:

I will describe shortly my little project application:

主要文档.内容是 Cdoc (包含字段 + 按钮的数据源).此按钮显示一个对话框,它是 Pdoc(一个数据源) - 在显示按钮之前,我将保存该文档.获取UNID,然后我将它传递给Pdoc,我想将CdocPdoc 与UNID 链接起来.显示对话框的我的按钮:

the main doc. content is Cdoc ( datasource which contains fields + a button ). This button displays a dialog which is Pdoc ( a datasource ) - before showing the button I will save the doc. to get the UNID and then I will pass it to the Pdoc, I want to link the Cdoc and Pdoc with the UNID. My button which shows the dialog:

<xp:button value="Adding Pdoc from the dialog" id="button3"
        styleClass="lotusFormButton" refreshMode="partial">

        <xp:eventHandler event="onclick" submit="true"
            refreshMode="partial" refreshId="computedField3">
            <xp:this.action><![CDATA[#{javascript: if ( Cdoc.isNewNote() ) { Cdoc.save(); }
Cdoc.setValue("computedField3",Cdoc.getDocument().getUniversalID());
getComponent('exampleDialog').show()}]]></xp:this.action>
        </xp:eventHandler>

对话框/Pdoc 只包含 1 个按钮:Save(因为 X 按钮被隐式添加到对话框中)

The dialog / Pdoc contains just 1 button: Save ( because the X button is implicitly added to the dialog )

<xp:button value="Salvare" id="button6" styleClass="lotusFormButton">

<xp:eventHandler event="onclick"
    submit="true" refreshMode="partial" immediate="false"
    save="false" refreshId="viewPanel1">
        <xp:this.action><![CDATA[#{javascript:Pdoc.save();     
getComponent('exampleDialog').hide();
   }]]>
           </xp:this.action>
</xp:eventHandler>

因此,它保存了文档.来自 Pdoc 并且它们显示在来自 Cdoc 的嵌入视图中.

So, it saves the docs. from Pdoc and they are displayed in an embedded view from Cdoc.

主要.doc Cdoc 还包含 2 个(动作)按钮:

The main. doc Cdoc contains also 2 (actions) buttons:

Cancel: redirect to Previous Page.

Save
<xp:button value="Salvare" id="buttonSave" styleClass="lotusFormButton" rendered="#{javascript:currentDocument.isEditable()}">

            <xp:eventHandler event="onclick" submit="true"
                refreshMode="partial" immediate="false" save="true"
                id="eventHandler1">
                <xp:this.action><![CDATA[#{javascript:if (Cdoc.getItemValueString("txt_UNID")!= "") { 

Cdoc.save(); 
}
facesContext.getExternalContext().redirect("http://ourserver.ro/XApp.nsf/view.xsp")

}]]></xp:this.action>
            </xp:eventHandler>
</xp:button>

问题是:

假设我将创建 3 个文档.来自 Pdoc 来自对话框,Cdoc.已保存(因为已获得 UNID).如果我使用 Cdoc Save, 保存,则 view.xsp 中的主视图面板将显示:

Let say I'll create 3 docs. from Pdoc from the dialog, the Cdoc. is already saved ( because the UNID was obtained ). If I save then using Cdoc Save, my main view panel from view.xsp will display:

  • 一份文件.Cdoc 及其 3 个 Pdoc 文档.(我只需要显示这个案例)

  • one doc. Cdoc with its 3 Pdoc docs. ( I need just this case to be displayed )

另一个Cdoc(我猜当我第一次获得UNID并保存Cdoc以获得UNID时,这就是Cdoc 在这种情况下.顺便说一句,如果我使用 Save 按钮再次保存 Cdoc,UNID 会改变吗?)和一个空的(不知道为什么)Pdoc 来自对话框.

another Cdoc ( I guess when I first obtain the UNID and I saved the Cdoc to obtain the UNID, this is the Cdoc in this case. Btw, if I save again Cdoc using the Save button , will the UNID will change ? ) and one empty ( don't know why ) Pdoc from the dialog.

我的 Cdoc 中的 Save 按钮应该是什么样的?我还应该更改 Pdoc 按钮中的 Save 吗?

How should my Save button from Cdoc should be like? Should I change also the Save from Pdoc button?

感谢您的时间.

推荐答案

我相信按钮上的 save="true" 将提交并保存页面上的所有数据源.这可以解释虚假的 Pdoc 文档.您正在脚本中调用保存,因此您不需要 save="true" - 您可以只使用普通的按钮类型而不是按钮的提交类型.

I believe save="true" on a button will submit and save all datasources on the page. That could explain spurious Pdoc documents. You're calling the save in script, so you don't need save="true" - you can just use a normal Button type rather than Submit type for the button.

一旦文档被保存,UNID 将不会改变.

Once a Document has been saved, the UNID will not be changed.

这篇关于xpages 保存/取消操作场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆