You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Serkan Camurcuoglu <se...@telenity.com> on 2008/09/17 16:30:48 UTC

About Wicket portlets, DatePicker, onLoad and onDomReady

Hi all,
While I was experimenting with date pickers in portlets, I've noticed 
something. When a portlet makes a header contribution, it cannot 
directly contribute to document's head, instead it generates something like:

<script type="text/javascript" src="/subscriber-web/buyOffer/ps:P-11c703e086b-10000/resources/org.apache.wicket.extensions.yui.YuiLib/yuiloader-beta.js"></script>
<script type="text/javascript" src="/subscriber-web/buyOffer/ps:P-11c703e086b-10000/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script>
<script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/


in the page body. Here P-11c703e086b is the portlet's id, and each 
portlet fragment on the page has a different id, and hence they load 
different javascript files (from the browser's point of view). So now, 
when I have two instances of the same portlet which contains date 
pickers, they both include their own wicket-event and yuiloader 
javascript files. The result of this is that only the date pickers in 
the second (last loaded) portlet work, and the date pickers in the first 
portlet do not work. I think that the global javascript objects from the 
last loaded file override the ones from the first (such as Wicket and 
YAHOO objects).

However, I've noticed that (while developing a different javascript 
behaviour for myself), if I execute the required javascript code during 
the onLoad event (instead of the onDomReady event), all of the date 
pickers work as expected. I have confirmed this by modifying the 
DatePicker class and using it within my portlets.

Does anybody have an explanation for this? I know that using onLoad is 
bad, but it seems to solve my problem..

(BTW I'm using wicket 1.3.4 and Jetspeed 2.1.3)

Best regards,

SerkanC



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