I have created a new XPage with a DynamicViewPanel that lists the documents in a certain Notes View. Then I have the dynamic view panel configured to show a check box for each row. I then created a button below the dynamic view panel with the plan to select a document(s) with the check box and click on the button to delete them. Below is my Xpages code for the button but why won't this work please?
<xp:button value="Delete" id="delete">
<xp:this.onclick submit="true" refreshMode="complete">
<![CDATA[#{javascript:var viewPanel=getComponent
("dynamicViewPanel1");
var docIDArray=viewPanel.getSelectedIds();
for(i=0; i < docIDArray.length; i++){
var docId=docIDArray[i];
var doc=database.getDocumentByID(docId);
doc.remove(true);
}}]]></xp:this.onclick>
</xp:button>
EDIT: Appears to be working now after changing to this below
<xp:button value="Delete" id="delete">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:actionGroup>
<![CDATA[#{javascript:var viewPanel=getComponent
("dynamicViewPanel1");
var docIDArray=viewPanel.getSelectedIds();
for(i=0; i < docIDArray.length; i++){
var docId=docIDArray[i];
var doc=database.getDocumentByID(docId);
doc.remove(true);
}}]]>
</xp:actionGroup>
</xp:this.action>
</xp:eventHandler>
</xp:button>