yes, i'm aware of those. but i'd want to 'remove' things from the
ajaxRequestTarget rather than append...
or, some way of attaching/executing behaviours only once?
On Thu, Nov 6, 2008 at 12:58 PM, Nino Saturnino Martinez Vazquez Wael
<[EMAIL PROTECTED]> wrote:
> theres a prepend / append js on ajaxRequestTarget, that should work...
>
> francisco treacy wrote:
>>
>> hi,
>>
>> we're using a home-grown wrapper for integrating jquery into wicket -
>> specifically for jquery effects.
>>
>> and i'm having some trouble with ajax updates. i'll explain with an
>> example:
>>
>>
>> final WebMarkupContainer listOfCommentsContainer = new
>> WebMarkupContainer("listOfCommentsContainer");
>> listOfCommentsContainer.setOutputMarkupId(true);
>> add(listOfCommentsContainer);
>>
>> AjaxLink<Void> numberOfCommentsLink = new
>> AjaxLink<Void>("numberOfCommentsLink") {
>> @Override
>> public void onClick(AjaxRequestTarget target) {
>>
>> target.addComponent(listOfCommentsContainer);
>> }
>> };
>>
>> listOfCommentsContainer.add(new JQueryEffectBehavior(new
>> SlideToggleEffect(), numberOfCommentsLink));
>>
>> add(numberOfCommentsLink);
>>
>> this code is basically outputting something like:
>>
>> <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>> Wicket.Event.add(window, "domready", function() {
>> $('#numberOfCommentsLink24').click(function() {
>> $('#listOfCommentsContainer25').slideToggle(450); }) ;});
>> /*-->]]>*/</script>
>>
>> listOfCommentsContainer25 being the target container to slide,
>> numberOfCommentsLink24 the trigger.
>>
>> this works fine per se. now when i click on numberOfCommentsLink24 ,
>> my list is refreshed (added it to the ajaxrequesttarget) and the
>> effect behaviour outputting javascript code again...
>>
>> <ajax-response><header-contribution><![CDATA[<head
>> xmlns:wicket="http://wicket.apache.org"><script type="text/javascript"
>>
>> src="resources/hub.app.wicket.components.jquery.JQueryResourceReference/jquery-1.2.6.js"></script>
>> <script type="text/javascript"
>>
>> src="resources/hub.app.wicket.components.jquery.JQueryEffectCoreResourceReference/jquery-1.2.6.effects.core.js"></script>
>> </head>]]></header-contribution>
>> (...)
>> <evaluate><![CDATA[$('#numberOfCommentsLink24').click(function() {
>> $('#listOfCommentsContainer25').slideToggle(450); })
>> ]]></evaluate></ajax-response>
>>
>> which means that i can visually perceive a very quick slideDown
>> followed by a slideUp (this is the normal slideToggle functionality).
>>
>> is there a way not to include the <evaluate> part? or detect if the
>> component has already been rendered in markup to check whether to
>> execute the behaviour again?
>> perhaps i'm missing some basic point here... any suggestions?
>>
>> thanks in advance,
>>
>> francisco
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> --
> -Wicket for love
>
> Nino Martinez Wael
> Java Specialist @ Jayway DK
> http://www.jayway.dk
> +45 2936 7684
>
>
> ---------------------------------------------------------------------
> 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]