XPage 保存数据源和新文档更改以前的文档 [英] XPages save data source and new doc changes previous doc

查看:19
本文介绍了XPage 保存数据源和新文档更改以前的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绑定到面板的文档数据源(创建没有父 ID 的文档).在面板内,我还有另外 2 个面板.完成面板 1 中的字段后,我单击一个链接以显示第二个面板,该面板上有一个保存按钮.保存后,文档将正确显示在数据库中.

I have a document data source (create document with no parent id) bound to a panel. Within the panel I have 2 other panels. On completing the fields in panel 1 I click a link to reveal the 2nd panel and that has a save button on it. Once saved the document appears in the db correctly.

保存按钮执行 dds 保存,然后清除所有字段,并在外部面板上执行部分更新,并在该面板上执行部分更新,因为我在主面板之外的 XPage 上还有其他 dd.

The save buttons does a dds save and then clears all fields and does a partial update on the outer panel and a partial execute on that panel too as I have other dds on the XPage outside of my main panel.

如果我现在创建另一个文档,则先前的文档会更新,而不是创建一个新文档.我为 dds 和其他选项尝试了不同的范围.不确定接下来要尝试什么.

If I now create another document the previous document gets updated rather than create a new doc. I've tried different scope for the dds and other options. Not sure what to try next.

有人知道是什么问题吗?

Anyone know what the problem is?

推荐答案

以下是如何添加具有部分刷新的新数据源的示例:

Here is a example how you can add a new datasource with a partial refresh:

<xp:panel id="myPanel">
    <xp:this.data>
        <xp:dominoDocument var="document1"></xp:dominoDocument>
    </xp:this.data>
    <xp:br></xp:br>
    <xp:inputText id="inputText1" value="#{document1.Test}"></xp:inputText>
    <xp:br></xp:br>
    <xp:br></xp:br>
    <xp:button value="Save" id="buttonSave">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="partial" refreshId="myPanel">
            <xp:this.action>

                <xp:actionGroup>
                    <xp:saveDocument var="document1"></xp:saveDocument>
                    <xp:executeScript>
                        <xp:this.script>
                            <![CDATA[#{javascript:
                                var panel = getComponent("myPanel");
                                var ds = new com.ibm.xsp.model.domino.DominoDocumentData();
                                ds.setComponent(panel);
                                ds.setVar("document1");
                                panel.getData().clear();
                                panel.addData(ds);
                            }]]>
                        </xp:this.script>
                    </xp:executeScript>
                </xp:actionGroup>
            </xp:this.action>
        </xp:eventHandler>
    </xp:button>
</xp:panel>

希望能帮到你

斯文

添加了一个 clear() 以从面板中删除所有以前定义的数据源.

Added a clear() to remove all previous defined datasources from the panel.

这篇关于XPage 保存数据源和新文档更改以前的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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