In one of my XPages application (for Client, XPiNC) I have a link to "Edit" an attachment of this document. I use the technology described in this blog article to get the attachment edited.
In that scenario I have three windows interacting:
- The XPage (XPiNC) containing the document where the link is clicked
- The Notes Document (called by notes:// URL) containing the attachment
- The application window containing the launched attachment (e.G. MS Word).
I managed to let the notes document (2) wait for the application (3) to finish and upload the modified attachment.
Now I need the XPage to wait for the backend change to occur and then to reload the XSP Document from the backend document to prohibit save conflicts.
I think the easiest way would be to pull out the attachments to attachment documents that are responses to the current document, but this is a rather old application that has large amounts of data in many many databases, and it is not feasible to convert all of these existing documents for that.
Now I search for the second best way to do it.
So again the question: How can I make the XPage "wait" for a backend change to occur and then reload the current page.
Second: How do I best "visualize" to the user, that something is running in the backend (Spinner, fade out, etc.).
The servers are 9.0.1FP2, the Clients unfortunately are 8.5.3 (cannot be updated at the moment).
Here is the Code, that I use in my "Open" Link:
<xp:link escape="true" text="Edit" id="attachmentEdit">
<xp:eventHandler event="onclick"
submit="true" refreshMode="partial" refreshId="tableAttachment">
<xp:this.action><![CDATA[#{javascript:var strAttachmentName:String = docs.toString();
var strReplid = database.getReplicaID();
var strUnid = document1.getDocument().getUniversalID();
var strServer = @Name( "[CN]" , database.getServer() );
var strUrl:String = "notes://" + strServer + "/"+strReplid+"/(ShowAttachment)?OpenForm";
session.setEnvironmentVar("InfothekCurrentAction","EDIT~" + strUnid + "~" + strAttachmentName);
view.postScript('window.location.href="'+strUrl+'"');}]]>
</xp:this.action>
</xp:eventHandler>
</xp:link>