Update view after using file upload - xpages

I am sure this is related to my question here
Null value for fileData:com.ibm.xsp.http.UploadedFile in dialog box?
Which I am still not 100% clear why the file upload control does not work directly in an extension pages dialog box.
But anyway I came up with my own solution using the file update control inside of a hidden panel. I need to set the button that uses the control to full update.
I have a button does an import of data. The button gets the file via a file upload control. This data is displayed in a view on the xpage.
The view is not being updated even though the Import button has Full Update. I am guessing that the full update actually get executed before the import actually completes?
Is there anyway to update my view after the import completes?

My understanding is that a File Upload requires a full refresh of the XPage to push the file up to the temporary folder on the server. At this point, the attachment is just stored in that temporary folder. It's not stored in the NSF. A subsequent function needs to be run to save that to a document.
Is your button doing the upload of the file to the temporary folder, or is it saving a Notes Document / directly accessing the temporary file and processing it via the back-end? If it's just performing the upload, the view won't upload.
The other thing I've come across is View Panels not immediately updating with new documents that have been created. In that scenario, a repeat control bound to NotesView.getDocumentsByKey() did immediately update.

I solved the issue by causing the button that uploads the file to display an extension pages dialog box. This dialog box has an OK button to close the message box but also refreshes the required part of the form.

Related

Problems calling SharePoint Document Library upload form with custom button

I'm trying to create a link (not actually a button, but styled as a button) that calls up the Upload.aspx for a document library but I'm running into issues once Upload.aspx loads. The main issue is that the Cancel button is non-functional. I can upload select a file and upload it (and this works), but if I were to have accidentally clicked on the initial link and want to navigate away without uploading, the Cancel button doesn't make the page go away.
Now I haven't been able to have Upload.aspx display as a dialogue box over the list page--it gets called as a full page (even though I have "Open forms in dialog" enabled). I'm wondering if that's what the Cancel button expecting. Any ideas? The link that is being called is:
/mySite/_layouts/15/Upload.aspx?List=%7B4982C5B5%2DCF88%2D497F%2DA48D%2D815D7A355F0A%7D&Source=https%3A%2F%2FmyServer%2Ecom%2FmySite%2FmyDocLibrary%2FForms%2FAllItems%2Easpx&isdlg=1"
Turns out it was the &isdlg=1 at the end of the URL that was causing the Cancel button to not work. I removed this from the URL and it works properly now.

XPage not syncing properly with backend data on partial refresh

I have an XPage that displays fields in a document. I also have the ability to pop out a new window that displays those same fields. I'm implementing a document locking scheme so that the two instances can't cause conflicts (and this is how I'm testing it).
A problem I've run into is that when the user edits the document in the pop out and saves it, a partial refresh of the panel containing those same fields in the original page doesn't show the updated data.
The save in the pop out was successful, and I can see in the Notes client that the document does indeed have the new value, but the original page simply won't show the new value. A complete page refresh using the reload button in the browser works, but I'd like to trigger this programmatically and as quickly as possible, hence the partial refresh.
Does anyone know what is going wrong? Is the NotesXspDocument in the original page getting out of sync with the backend document? I read about document1.getDocument(true), but that doesn't seem to do anything.
(As usual, I can't supply source code unfortunately....)
Once the NotesXspDocument is loaded with the XPage, a partial refresh does not update the xspDoc from the back-end DB, but from the in-memory DataSource.
You will need to refresh the XPage:
Reload the url from browser or in ssjs with a context.reloadPage()

Why is my fileDownload control showing the trashcan even in read mode?

This is a rather strange one I think, and I'm sure I made a mistake here myself:
in one of my applications I'm showing a fileDownload control bound to a Richtext field in my underlying NotesDocument. The control's properties a are set to Hide if no attachments, show size, type and created as well as allow delete. The control itself sits inside a custom control, being part of another custom control, similar to this:
Xpage.xsp
- ccContainer
- - ccInnerDoc
Document datasources for both the container and the "inner" doc are defined at the root of ccContainer and passed into the inner doc.
The inner doc's datasource is comnputed based on a document selection, and it's igenoreRequestParams property is set to false so that I can display the contents of the selected datasource in a given panel etc.
The selected doc is first opened in read mode, and I can set it to edit mode using a button.
Problem now is that my file download control always is showing the delete icon (trashcan) no matter which mode the doc is opened in. And it's not only the icon showing, it also pretends to work by asking me whether I really want to delete and then really removes the file attachment. Only that this change of course cannot be stored into the datasource because it's only open in read mode.
I'm sure that this behaviour is some side-effect of something else in my application (to a certain extent I rebuilt this in a plain new db and until now cannot reproduce it), but I'm at the end of my knowledge of what this could be.
Any hint of what could be causing this is more than welcome.
In place of #Frantisek Kossuth I answer this myself: see compute dynamically the allowDelete property of file download xpages
Thanks again, Frantisek!

Xpages File Upload Control does nothing

Background: One xpage bound to document1. On this xpages is a tabbed table contain several tabs. Each tab contains an panel bound to other data sources incl document2. Document2 is created and made a child of document1. In each panel is a table to allow the user to create the new document, as well as two view controls. Everything works beautifully...until...
Problem: I was asked to add a way to upload an attachment to the child document. I first created an rich text field on the bound document called "ScannedInvoice". I then create a File Upload Control from the core controls and bound it to document2/ScannedInvoice. By rule, I only want a single attachment, otherwise I would consider the openNTF upload control.
I cannot figure out why nothing appears on the back end when I upload a file and create a new document. Everything else works, but there is no attachment in the ScannedInvoice field and also no $FILE fields attached to the document either.
Thanks in advance for any tips. I have searched quite a bit and have not found any answers. - Steve
<xp:fileUpload id="fileUpload1"
value="#{document2.ScannedInvoice}" useUploadname="false"
style="font-size:8pt" filename="scannedinvoice.jpg"
mimetype="image/jpeg">
</xp:fileUpload>
Note: The field ScannedInvoice on the Invoice form is rich text.
Code to save button: document2.save()
Document2 has scope=request and ignoreRequestParam=true. Both of these have to be set like this in order to work. parentID=# document1.getNoteID()
a file upload needs a full refresh of the page to be able to upload the file. Make sure that you are doing that.
======================================
Update Domino 9.0.1 supports partial refresh uploads

Dynamic Content Control in Extlib flips out after rebuild

I have an issue with the dynamic content control in ExtLib. Every time I compile my xpage the dynamic content control flips out if I do not reload the page. I need a way to control this, like an onerror event on the control.
this is wahat's happening
I open my webpage, the dynamic content control works fine
I do some changes to my xpages and build (webpage still open)
I click a link on my webpage to reload the content in the dynamic content control.
the webpage flips out and starts to reload constantly using a partial refresh url.
I use various ways to update this control. sometimes it is through a csjs link and somtimes it is per interval using XSP.partialRefreshGet() so I guess I need a way to know if the dynamic content control is available before calling it, or let the control notify me somehow that is is not available
any idea?
Thanks
Thomas
When you change an XPage you must do a manual full reload of that page in any browser. Executing any call from the stale page will not work.

Resources