How can I refresh the XPages File Download Control and have it display updated attachments without full page refresh?

早过忘川 提交于 2020-01-11 12:05:12

问题


When I create file download control on a document I can display the attached files from a Rich Text Field.

In a separate process I am attaching more documents to the same document. I want to periodically refresh the download control container to see if there are new attachments. I do not want to do a full refresh of the page.

I have discovered that the partialRefresh of the file download control container either programmatically or manually does not result in the contents (downloadable files) being accurately updated.

XSP.partialRefreshGet('view:_id1:fileDownload1')

A full refresh of the screen shows the newly attached documents but I want to be able to partial refresh the panel container and see the new documents without full page refresh.

I have added a Random() computed text value into the panel and I can see that it is being refreshing correctly. I have even looked at the xhr response from the server and I can see that there is an update being made - but not with the new attachments in it - the "attached files" are not refreshing without full page refresh.

I can only assume this is a feature of the filedownload control in that it does not know that new files are attached at any other time other than page load.

Suggestions?


回答1:


When partially refreshing a XPage, the datasources are not reloaded, only their last state (stored in memory or hdd ) is restored. If you change the scope of your datasource to request, the XPages engine is forced to recreate the datasource instead of using the cached one on each request (which includes partial refreshs).

This should allow you to refresh your fileDownload control without a full refresh.




回答2:


Marky,

Yes, I have run into this before. You must do a full refresh with attachments.

http://xpagesblog.com/XPagesHome.nsf/Entry.xsp?documentId=FBAC0D921B677EA0852578CB006678D7

The link is fairly old, but I believe it still applies.

Matt White says in the article comments: "...Basically it is not currently possible to post a file attachment over AJAX, you either have to use Flash or a virtual iFrame solution if you don't want the entire page to refresh. As far as I know there is nothing that IBM can do about this at the moment. Matt"



来源:https://stackoverflow.com/questions/18664774/how-can-i-refresh-the-xpages-file-download-control-and-have-it-display-updated-a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!