I have db1.nsf/doc1 open in an XPage. On the XPage is a view of of related documents (db2.nsf/doc2) on the same server. I am using a repeat control with a link wrapped around each entry to open doc2 in an ExtLib dialog.
Note: Because doc2 has fileUpload and fileDownload controls on it, I have to open doc2 in an iframe in the dialog (v8.5.3). I have all the file upload/download stuff working thanks to Toohey's article File Upload XPage Forms via OpenNTF.org Extension Library Dialogs.
The problem is that I am unable to close the dialog with a button in the iframe in the dialog. The difference between my scenario and Toohey's is that I am working with 2 different documents in 2 different databases. The parent opener is an XPage with datasource doc1 in db1 while the dialog child is doc2 in db2. I don't seem to be able to get a handle on the parent document from within the child document in the iframe so i can close the dialog. It looks something like this:
<button id="okBtn" type="submit">OK</button>
*Note: showDialog.xsp is an XPage in db1 with it's datasource being db2.nsf/doc2. (I'm using xp:panel with tagName="iframe".)
I want the OK button to save the document (which it does) and close the dialog (which it doesn't). I have tried several different methods of "parent. ..." to get a handle on and close it - with no success at all.
How do I get a handle on the dialog element from within the iframe so I can close it?
*Added server version.
The way the XPages Extension Library dialog works is that it runs SSJS, then calls
view.postScript() to pass CSJS back to the browser to close the dialog. You need to reproduce that. (I'm not sure what server version you're using but
view.postScript() was only added in 8.5.3, probably for the dialog use case.)
I'm not familiar with the functionality you're using, but 9.0.1 provided the ability to upload attachments within a partial refresh, which resolves workarounds for Ext Lib dialogs.
databaseName property of a datasource can be computed (format is serverName!!filePath), so data being in a separate database should not be an issue. Indeed most applications I build now separate XPages into one NSF and data / forms / views / agents in another. That application architecture is required anyway for XPages on Bluemix, and standard for other web application development.