Reputation:
I have created a view which contains some documents. I want to be able to click on the check box next to specific documents and move them to another view (or somehow display them on another page) and back again. So basically I want to be able to archive documents, then go to the page where I have sent these documents and remove them from archive back to the view where the documents were originally.
So far I have (this is my view table which is on the xpage with a check box next to my documents)
<xp:viewPanel rows="10" id="viewPanel2" viewStyle="width:700.0px">
<xp:this.facets>
<xp:pager partialRefresh="true" layout="Previous Group Next"
xp:key="headerPager" id="pager2">
</xp:pager>
</xp:this.facets>
<xp:this.data>
<xp:dominoView var="allDocsView" viewName="profilesAllDocs">
</xp:dominoView>
</xp:this.data>
<xp:viewColumn columnName="LastActivationDate" id="viewColumn6"
style="font-size:12pt" showCheckbox="true">
<xp:viewColumnHeader value="Last Activation Date"
id="viewColumnHeader6" sortable="true" style="font-size:12pt">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="LoggerID" id="viewColumn7"
displayAs="link" openDocAsReadonly="true" style="font-size:12pt">
<xp:this.converter>
<xp:convertNumber type="number" integerOnly="true">
</xp:convertNumber>
</xp:this.converter>
<xp:viewColumnHeader value="Logger ID" id="viewColumnHeader7"
style="font-size:12pt">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="ExpectedArrivalDate" id="viewColumn8"
style="font-size:12pt">
<xp:viewColumnHeader value="Expected Arrival Date"
id="viewColumnHeader8" style="font-size:12pt">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="Status" id="viewColumn9"
style="font-size:12pt">
<xp:viewColumnHeader value="Status" id="viewColumnHeader9"
style="font-size:12pt">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="Alert" id="viewColumn10"
style="font-size:12pt">
<xp:viewColumnHeader value="Alert" id="viewColumnHeader10"
style="font-size:12pt">
</xp:viewColumnHeader>
</xp:viewColumn>
</xp:viewPanel>
I have also created a button. The idea is to select some documents using the check box, click on this button and it will send the documents to another xpages (archive).
I am not sure what code to assign to the button and the check box and how the button will know where to send the documents. Any suggestions will be appreciated.
Upvotes: 0
Views: 231
Reputation:
I didn't really need to move documents after all, just hide them, as some of you have suggested.
I had a view with a column called Archive which was hidden for presentation purposes. The values in the Archive were either No or Yes (No - not Archived, Yes - Archived). The next column had a check box which was used to select rows which need to be Archived. All I did was set the view to "Filter by column value" and I set the field to No. This way the view showed rows which only have No under Archived. To Archive a row I had a button with this code
var viewPanel=getComponent("viewPanel1");
var docIDArray=viewPanel.getSelectedIds();
for(i=0;i < docIDArray.length; i++)
{
var docId=docIDArray[i];
var doc=database.getDocumentByID(docId);
doc.replaceItemValue("Archive","Yes");
doc.save();
}
The code changed the value in the Archive from No to Yes and hid it in the view. To remove a doc from archive same method but it will show all values with Yes and change the Archive field to No.
Upvotes: 0
Reputation: 6936
If you need to send documents from one view to another then you need to look at that view's selection formula. Then set the values of required field of the document so that it satisfies that selection formula. The same would go if you want to bring back the document to its original view.
In XPages you can get the selected document's notes ID using the below code (shamelessly lifted from here :))
var viewPanel=getComponent("viewPanel2");
var docIDArray = viewPanel.getSelectedIds();
for(i=0; i < docIDArray.length; i++) {
var doc = database.getDocumentByID(docIDArray[i]);
// Code to manipulate the 'doc' object
}
Upvotes: 4