On Mon, 10 Nov 2008, Steve Swinsburg wrote:
> I am wanting to combine an AjaxRequestTarget addComponent call with a
> javascript call as well so that the component is added to the page by
> wicket, but displayed using a jQuery effect. The component adds to the
> page fine, but the jQuery effect doesn't seem to be working, the
> component just appears. Is it something to do with the order of when
> its set to be visible/prepend/append javascript?
Do you have the "normal" markup of changePicture in the
HTML?
You can check with the Ajax debug console (visible when
running Wicket in development mode, -Dwicket.configuration=DEVELOPMENT)
but I think that probably when you do this
> public void onClick(AjaxRequestTarget target) {
>
> //add the full changePicture component to the page
> dynamically
> target.addComponent(changePicture);
> changePicture.setVisible(true);
> String js = "$('#" + changePicture.getMarkupId() +
> "').fadeIn('slow')";
> target.appendJavascript(js);
>
> }
making changePicture visible with normal Wicket ajax will
just write it normally in the DOM tree. Remember that the
Wicket invisibility is "stronger" than the Javascript
visibility in the sense that non-visible Wicket components
are not rendered at all (just a placeholder tag is outputted
if you set setOutputMarkupPlaceHolderTag(true)).
I think that in order to be able to make changePicture
visible via Javascript (that manipulates DOM objects), you
have to make it invisible but available on the DOM level,
i.e. set display: none either in the markup or via
Javascript before the fadeIn javascript.
It would be interesting to hear a working solution.
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]