You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Emanuele Gesuato <eg...@ibc.it> on 2008/12/12 14:02:30 UTC

Using ajax for generating a pdf

Hi there,

Reading previous posts i have discovered the existence of the yui 
context menu in wicket stuff that now i'm using in a project.

More specifically, i'm using wicket 1.3.4 with wicket-yui-core 1.3.0 
from the wicket 1.3.0 branch of wicketstuff.

I would like to do a non-ajax click in my context menu because i need to 
generate a pdf report and propose to the user the classic download 
window of the browser. Using ajax, the pdf is generated but the ajax 
response is empty and the user doesn't see anything.
This is my actual code in the MenuItem.onClick(AjaxRequestTarget, targetId):


IResourceStream stream = new ByteArrayResource("application/pdf", 
s.toByteArray()).getResourceStream();
						RequestCycle.get().setRequestTarget(new 
ResourceStreamRequestTarget(stream));		


With these lines if i do a "normal" submit the user could see the 
download window with the pdf generated. Using an ajax-click it doesn't work.

The YuiContextMenuBehaviour in the respond method calls the 
YuiContextMenu.onClick(AjaxRequestTarget, targetId). But in the 
YuiContextMenu there is a method "onClick()" which seems not called by 
anyone.

For me, it seems that the "onClick()" could resolve my issue (it doesn't 
use ajax) but i don't know why it is not called by anyone. Is it 
deprecated ?


Thanks,
Emanuele





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Using ajax for generating a pdf

Posted by Emanuele Gesuato <em...@virgilio.it>.
Emanuele Gesuato ha scritto:
> 
> 

I forgot to mention i'm using the yui-context menu related to the wicket 
branch 1.3.0 of wicket-stuff. The ajax link i'm mentioning is just a 
menu item of the context menu that display a pdf.

Tomorrow i'll try to use a simple ajax link and let you know what happens :)


Any help would be appreciated,
Thanks,
Emanuele Gesuato

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org