Forums de discussion

Buttons freeze on downloading a resource

R V, modifié il y a 11 années.

Buttons freeze on downloading a resource

New Member Publications: 18 Date d'inscription: 11/01/12 Publications récentes
I am using resourceURL and overriding serveResource method on the portlet to download a csv file. I am using the following snippet of code ( see below). After the file download starts, all the aui buttons on the page are dsabled and the page freezes. Has anybody seen this problem before? Is there any javascript trick that I am missing. I think probably this needs to run asynchronously and that is the problem. I am not sure how it needs to be changed. Any help is appreciated.

<aui:button onClick='<%= renderResponse.getNamespace() + "downloadOrders()"%>' value="DownloadOrders" />
<aui:script>
Liferay.provide(
window,
'<portlet:namespace />downloadOrders',
function() {

submitForm(document.<portlet:namespace />fm, "<portlet:resourceURL></portlet:resourceURL>");


},
['liferay-util-list-fields']
);
</aui:script>
R V, modifié il y a 11 années.

RE: Buttons freeze on downloading a resource

New Member Publications: 18 Date d'inscription: 11/01/12 Publications récentes
I came across another issue posted a while back. This is exactly what I am seeing.

http://www.liferay.com/community/forums/-/message_boards/message/692188
R V, modifié il y a 11 années.

RE: Buttons freeze on downloading a resource

New Member Publications: 18 Date d'inscription: 11/01/12 Publications récentes
Any ideas yet, the buttons are disabled, that is what I meant by freeze, sorry :-)

1. I have implemented resourceURL and overridden serveResource on the portlet to serve a csv file.
2. I click on the download button on the portlet.
3. In the serveResource method, I make a call to ServletResponseUtil.sendFile in the serveResouce method.
4. The download prompt on the browser appears, But now all the buttons including the download button are disabled.

My goal is to enable the buttons that are getting automatically disabled during the download process..

Is this some native browser behavior that is tied to downloading a resource, not sure why this is happening, I am calling the submit form from Liferay.provide, see my jsp code below,

I have tried the following:

1. adding return false to the submitForm at the end in the second argument "<portlet:resourceURL></portlet:resourceURL>;return false;" This does not work.
2. I am trying to refresh, but again this enables the buttons but download does not happen :-(


Any help is appreciated.

<aui:script>
Liferay.provide(
window,
'<portlet:namespace />downloadOrders',
function() {
[indent]
document.<portlet:namespace />fm.<portlet:namespace /><%= Constants.CMD %>.value = "downloadOrders";
document.<portlet:namespace />fm.<portlet:namespace />exportOrderIds.value = Liferay.Util.listCheckedExcept(document.<portlet:namespace />fm, "<portlet:namespace />allRowIds");
submitForm(document.<portlet:namespace />fm, "<portlet:resourceURL></portlet:resourceURL>");[indent][/indent][/indent]
},
['liferay-util-list-fields']
);
</aui:script>