问题
I created a Dynamic View Panel. I have check boxes on. I have called this "dynamicViewPanel1" and I have set the Data Source name to "dViewData"
So far so good, everything works fine.
Now I created a button called "Delete" and set it to a simple action of delete selected documents and set the view control to "dViewData".
When I select one or more documents and click delete I get the following error.
javax.faces.FacesException: Unable to find target view control dViewData. I take it because the data source is wrapped inside the Dynamic View panel?
I've checked the documentation, but I can't see how get the button to recognize the selected documents. Can anyone help me with this?
回答1:
Did you see and try this? http://www-10.lotus.com/ldd/ddwiki.nsf/dx/2008-11-11033022WEBBZ4.htm
var viewPanel=getComponent("viewPanel1");get the componet of viewPanel
var docIDArray=viewPanel.getSelectedIds(); get the array of document ids
for(i=0;
i < docIDArray.length;
i++){
var docId=docIDArray[i];
var doc=database.getDocumentByID(docId);
.. your code to deal with the selected document
}
(I think the code above only handle view panels in the current database though)
来源:https://stackoverflow.com/questions/13528947/how-do-i-delete-selected-documents-in-a-xpage-dynamic-view-panel