You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Steve Swinsburg <st...@gmail.com> on 2010/07/02 10:18:01 UTC

StringHeaderContributor from a panel added by AJAX

Hi,

I have a panel that I add via AJAX to my page. On this panel I have a StringHeaderContributor block that I want to add. It's not doing anything. Does this not work when added via AJAX? The same code works fine when on a normal page. 

String altText = "some value from an i18n properties file";
StringHeaderContributor initJavascript = new StringHeaderContributor(
				"<script type=\"text/javascript\">" +
					"$(document).ready( function(){" +
						"initDatePickerAltText(' " + altText + "');" +
					"});" +
				"</script>");
		add(initJavascript);


The reason I need to do this is because I need to send an internationalised string to a javascript function to set up it's alt text which I retrieve from the message bundle.  I can't do this on the base page because the javascript component hasn't been added to the page at this stage.

thanks,
Steve

Re: StringHeaderContributor from a panel added by AJAX

Posted by nino martinez wael <ni...@gmail.com>.
yeah im just talking about implementing the interface instead of using the
class directly.. I've seen it working, instead of using implementation..

2010/7/2 Steve Swinsburg <st...@gmail.com>

> Thanks, but the ajax component is actually just a datepicker from jQuery so
> it's not Wicket related. I think I'll need to get my Javascript to load the
> message bundle directly so it doesn't need to go via Wicket.
>
> cheers,
> Steve
>
>
> On 02/07/2010, at 6:46 PM, nino martinez wael wrote:
>
> > Im have you tried implementing the headercontributor Interface in your
> ajax
> > component instead of using the headercontributor directly?
> >
> > regards Nino
> >
> > 2010/7/2 Steve Swinsburg <st...@gmail.com>
> >
> >> Hi,
> >>
> >> I have a panel that I add via AJAX to my page. On this panel I have a
> >> StringHeaderContributor block that I want to add. It's not doing
> anything.
> >> Does this not work when added via AJAX? The same code works fine when on
> a
> >> normal page.
> >>
> >> String altText = "some value from an i18n properties file";
> >> StringHeaderContributor initJavascript = new StringHeaderContributor(
> >> "<script type=\"text/javascript\">" +
> >> "$(document).ready( function(){" +
> >> "initDatePickerAltText(' " + altText + "');" +
> >> "});" +
> >> "</script>");
> >> add(initJavascript);
> >>
> >>
> >> The reason I need to do this is because I need to send an
> internationalised
> >> string to a javascript function to set up it's alt text which I retrieve
> >> from the message bundle.  I can't do this on the base page because the
> >> javascript component hasn't been added to the page at this stage.
> >>
> >> thanks,
> >> Steve
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: StringHeaderContributor from a panel added by AJAX

Posted by Steve Swinsburg <st...@gmail.com>.
Thanks, but the ajax component is actually just a datepicker from jQuery so it's not Wicket related. I think I'll need to get my Javascript to load the message bundle directly so it doesn't need to go via Wicket.

cheers,
Steve


On 02/07/2010, at 6:46 PM, nino martinez wael wrote:

> Im have you tried implementing the headercontributor Interface in your ajax
> component instead of using the headercontributor directly?
> 
> regards Nino
> 
> 2010/7/2 Steve Swinsburg <st...@gmail.com>
> 
>> Hi,
>> 
>> I have a panel that I add via AJAX to my page. On this panel I have a
>> StringHeaderContributor block that I want to add. It's not doing anything.
>> Does this not work when added via AJAX? The same code works fine when on a
>> normal page.
>> 
>> String altText = "some value from an i18n properties file";
>> StringHeaderContributor initJavascript = new StringHeaderContributor(
>> "<script type=\"text/javascript\">" +
>> "$(document).ready( function(){" +
>> "initDatePickerAltText(' " + altText + "');" +
>> "});" +
>> "</script>");
>> add(initJavascript);
>> 
>> 
>> The reason I need to do this is because I need to send an internationalised
>> string to a javascript function to set up it's alt text which I retrieve
>> from the message bundle.  I can't do this on the base page because the
>> javascript component hasn't been added to the page at this stage.
>> 
>> thanks,
>> Steve
>> 


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


Re: StringHeaderContributor from a panel added by AJAX

Posted by nino martinez wael <ni...@gmail.com>.
Im have you tried implementing the headercontributor Interface in your ajax
component instead of using the headercontributor directly?

regards Nino

2010/7/2 Steve Swinsburg <st...@gmail.com>

> Hi,
>
> I have a panel that I add via AJAX to my page. On this panel I have a
> StringHeaderContributor block that I want to add. It's not doing anything.
> Does this not work when added via AJAX? The same code works fine when on a
> normal page.
>
> String altText = "some value from an i18n properties file";
> StringHeaderContributor initJavascript = new StringHeaderContributor(
> "<script type=\"text/javascript\">" +
> "$(document).ready( function(){" +
> "initDatePickerAltText(' " + altText + "');" +
> "});" +
> "</script>");
> add(initJavascript);
>
>
> The reason I need to do this is because I need to send an internationalised
> string to a javascript function to set up it's alt text which I retrieve
> from the message bundle.  I can't do this on the base page because the
> javascript component hasn't been added to the page at this stage.
>
> thanks,
> Steve
>