我在这里找到了答案上计算器。我的按钮事件处理程序看起来如下:
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="pnlContainer"
action="#{javascript:if (compositeData.actionButton.action) if (!compositeData.actionButton.action.call()) return;}">
</xp:eventHandler>
对于我的自定义控件我已成立了一个属性:
<property>
<property-name>action</property-name>
<property-class>javax.faces.el.MethodBinding</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.ide.xfaces.internal.editors.MethodBindingEditor</editor>
</designer-extension>
</property-extension>
<description>ssjs that action button must perform</description>
</property>
确保类和编辑如上。
然后在包含自定义控制设置XPAGE的属性包含SSJS:
action="#{javascript:removeSelected}"
这是驻留在SSJS脚本库的功能。这里的关键是不提供括号的任何参数(!!!)
的SSJS功能如下:。
function removeSelected(){
var accessList = sessionScope.get("removalList");
var nsf_committee = datasources["COM1_DB_FILEPATH"];
var db:NotesDatabase = session.getDatabase(session.getServerName(), nsf_committee);
for (var i = 0; i < accessList.length; i++) {
var doc:NotesDocument = db.getDocumentByUNID(accessList[i]);
if (null != doc){
doc.remove(true);
accessList.remove(accessList[i]);
}
}
}
(这里我从数据库中删除文档UNID ID的驻留在一个ArrayList列表通过复选框组设置为我的重复控制中的每一行)
您也可以将函数本身交给对象类型的参数 – stwissel