Re: Finding out when actionLink action is completed on the user side

Christian Riedel <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <[email protected]>
Sure, the equivalent in 5.3 is to use t:zone or better: write a mixin and add a custom listener to your link.
I once wrote a very generic mixin that you can use as click or change (or any event) listener:

https://gist.github.com/criedel/315d0cf8dab312870a7bc0d184ef0dd4

I think there are also similar examples to be found here: http://jumpstart.doublenegative.com.au/jumpstart/examples/input/atonevent/0




> Am 27.03.2017 um 17:05 schrieb g kuczera <[email protected]>:
> 
> Right now we are using Tapestry 5.3.7 and upgrading is unlikely, so the
> async option is out of the reach, I think. I also do not want to open the
> save-file-dialog by default (the requirement from the client).
> 
> I will check the FileSaver as soon as I can.
> 
> Is there a possibility that the zones could be used to refresh the button
> state (changing from disabled to enabled)?
> 
> 2017-03-27 11:19 GMT+02:00 Christian Riedel <[email protected]>:
> 
>> you could use t:async="true“ instead and return the pdf along with some
>> custom script that re-activates your button.
>> the binary of the pdf could be passed into FileSaver[0] to create the
>> save-file-dialog of the browser. while all this happens you could show a
>> progress indicator to the user.
>> 
>> if you find this too complicated you could keep the traditional requests
>> but maybe open a popup that triggers the download.
>> 
>> [0] https://github.com/eligrey/FileSaver.js
>> 
>>> Am 27.03.2017 um 10:36 schrieb g kuczera <[email protected]>:
>>> 
>>> Hi everybody,
>>> I have an actionLink, which action returns the pdf document from the
>>> server. The document is dynamically generated, so it can take few seconds
>>> to deliver it to the user. I want to prevent the user from clicking on
>> the
>>> actionLink multiple times. I can block it in java script after the click
>>> event occurrs, but I don't know how to find out when to unblock it.
>>> 
>>> Is there a way to find out when the document is received by the user and
>>> then unblock the actionLink? I found one possible solution, but it seems
>>> like an overhead:
>>> http://stackoverflow.com/questions/1106377/detect-when-
>> browser-receives-file-download
>>> Is there a more tapestry way to do it?
>>> 
>>> Here is the actionLink code:
>>>                                   <t:actionLink
>>> t:id="downloadDocumentAsPdf" context="document.document_id"
>>>                                       target="_blank">
>>>                                       ${message:download.document.
>> as.pdf}
>>>                                   </t:actionLink>
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.