0

我有一个绑定到视图数据源的重复控件。

在每一行中,我都有一个链接,当按下该链接时,我想用一些字段值更改标记该后端文档,然后保存这些更改。如果保存时发生错误,我想告诉用户我希望刷新存在重复的面板。

如何获取与该行关联的文档并测试保存是否有效?

4

3 回答 3

0

快到了,但后端文档没有改变:o(

我的重复控件内的链接代码...

var doc:NotesDocument = data.getDocument();
var dt:NotesDateTime = session.createDateTime("Today");
dt.setNow();
doc.replaceItemValue("RcptDate", dt);
doc.replaceItemValue("RcptBy", sessionScope.get("customerBuyerName"));
doc.replaceItemValue("RcptStatus", "Receipted");

var dsName = "vdsReceipts.DATASOURCE";
var app = facesContext.getApplication();
var ds = app.getVariableResolver().resolveVariable(facesContext, dsName);
var ret = ds.save( facesContext, true );
于 2013-03-06T10:47:52.010 回答
0

尝试在文档上调用保存,而不是视图数据源:

var doc:NotesDocument = data.getDocument();
var dt:NotesDateTime = session.createDateTime("Today");
dt.setNow();
doc.replaceItemValue("RcptDate", dt);
doc.replaceItemValue("RcptBy", sessionScope.get("customerBuyerName"));
doc.replaceItemValue("RcptStatus", "Receipted");
doc.save(true, false);
于 2013-03-06T11:05:13.533 回答
0

我很好奇脚本是否正在获取文档的句柄。如果重复控件中没有 var="data" ,则它永远不会获得文档的句柄。

更大的问题是,您永远不会发出 doc.Save,而是保存不同的对象。因此,将保存添加到脚本的上半部分。

var doc:NotesDocument = data.getDocument();
var dt:NotesDateTime = session.createDateTime("Today");
dt.setNow();
doc.replaceItemValue("RcptDate", dt);
doc.replaceItemValue("RcptBy", sessionScope.get("customerBuyerName"));
doc.replaceItemValue("RcptStatus", "Receipted");
doc.Save();

实际保存后,您可以查看数据源以查看它是否已保存。如果它们都在同一个数据库中,我认为那将是矫枉过正。

希望这样做。

于 2013-03-06T16:21:22.390 回答