Hey Jeremy,
You can try the attribute modifier. Try this:
final Label label = new Label("image");
....
....
AjaxLink someLink = new AjaxLink(".....") {
public void onClick(AjaxRequestTarget ajaxRequestTarget)
{
AttributeModifier attributeModifier = new
AttributeModifier("src", true, new Model("new path to the file"));
label.add(attributeModifier);
label.setOutputMarkupId(true);
.....
}
}
I hope it helps. It may not be the best way to do it .. but works for me ;)
~Ravi Gidwani.
Jeremy Levy-2 wrote:
>
> I have an AjaxLink link that I am trying to use to update an image, in the
> onClick method I am replacing the Model of the image to the new path,
> however it's not working. I've tried it with Image and NonCachingImage,
> and
> also turned off Caching in FireFox. I'm not sure but the XML being sent
> doesn't look correct. I'm using 1.2.5. Here are the relevant code
> snipits:
>
>
> ...
> final NonCachingImage warningImage = new
> NonCachingImage("warningImage", new Model("images/alert_orange.png"));
> warningImage.setOutputMarkupId(true);
> add(warningImage);
> ...
>
> final AjaxLink link = new AjaxLink("theLink") {
> public void onClick(AjaxRequestTarget ajaxRequestTarget) {
> log.debug("Link Clicked...");
>
> warningImage.setModel(new
> Model("images/alert_green.png"));
> ajaxRequestTarget.addComponent(warningImage);
> }
> };
> add(link);
>
>>From the AJAX Console:
>
> INFO:
> INFO: Initiating Ajax GET request on
> /1/meetmoi?x=YuQ6ay6aKBGDiO5OfiMmT7sqTYDzw7kvj2TxXBaK1HxBbP9XAjorn1Zpm4EovOnWCZVHg*4WCL-uPukV*-Oz2CeAsvJdoPkh&wicket:behaviorId=0&random=0.337860019529019
> INFO: Invoking pre-call handler(s)...
> INFO: Received ajax response (388 characters)
> INFO:
> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
> id="notYetActive_repeatingAlerts_1_aAlert_warningImage" ><![CDATA[
> /1/meetmoi/resources/com.mdate.web.panels.alerts.MobileNotValidatedAlert/images/alert_orange_en_US.png?wicket:antiCache=1181744625859
> ]]></component></ajax-response>
> INFO: Response parsed. Now invoking steps...
> INFO: Response processed successfully.
> INFO: Invoking post-call handler(s)...
>
>
> Thanks.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
--
View this message in context:
http://www.nabble.com/AjaxLink-not-updating-Image-tf3915168.html#a11166175
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user