我在這裏找到了答案上計算器。我的按鈕事件處理程序看起來如下:
<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