On Tue, Mar 7, 2017 at 9:00 PM, Martin Grigorov <mgrigo...@apache.org> wrote:
> > On Tue, Mar 7, 2017 at 5:09 PM, SeldonCrisis <nmbara...@gmail.com> wrote: > >> Sure, I can do that! *BUT* in exchange, I'll need /a little/ more help... >> >> I basically used the solution that Ernesto had provided for us, I just >> needed to spend some time understanding how it worked: >> AJAX update and file download in one blow >> <https://cwiki.apache.org/confluence/display/WICKET/AJAX+ >> update+and+file+download+in+one+blow> >> >> And here is how I implemented it (I am using SAP Crystal Reports for >> docgen, >> in case anyone was curious) >> >> *First, I created my own custom resource.* >> >> /returnStream()/ had to be implemented because /AJAXDownload/, the class >> provided to us by Ernesto, is using the hook method /getResourceStream()/, >> which expects an /IResourceStream/ object. >> >> *Second, I implemented Ernestos class. I've posted the link, please refer >> to >> that for the code.* >> *Important*: you can change the way the resource is provided (in window/as >> download) in the /onRequest()/ method of /AJAXDownload/ as such: >> >> >> *Third, I used my resource and Ernestos AjaxBehavior in conjunction on the >> same button, so I was able to initiate a download AND change the >> visibility >> of components with the same input event: * >> >> And that was it. Much easier than I had made it out to be, I was just >> intimidated because I'm a wicket noob. >> >> *BUT Here is my new problem*: I still need the resource to be displayed >> in a >> new tab as opposed to as a download or in the same window. As you can >> see, I >> tried implementing >> but it still wont work. Keep in mind that I would really like for this to >> be >> a button. I know I could just style a link to look like a button with CSS, >> but that is a work-around solution (one that I'm not very fond of). There >> must be a way, but at this point I'm a little stumped. Any ideas? >> > > In https://issues.apache.org/jira/browse/WICKET-6286 we introduce an > improved version of AjaxDownload. > It supports downloading via redirect as the original version and via > iframe, this one supports callbacks. > I wonder whether by using a third approach, window.open(), we could add > support for your use case too. > Let me try ! > It works ! Added the functionality with https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=bb46817 > > >> >> >> -- >> View this message in context: http://apache-wicket.1842946.n >> 4.nabble.com/Display-PDF-in-new-tab-tp4677202p4677260.html >> Sent from the Users forum mailing list archive at Nabble.com. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >