I have a charting application that I tried to convert to Ajax, so that as chart options are changed, the image is reloaded via AJAX, but for whatever reasons, it is not being reloaded.

I have the following code:

checkBox.add(new AjaxFormComponentUpdatingBehavior("onchange")
                        {

protected void onUpdate(AjaxRequestTarget target)
                            {
                               reRender();
                               target.addComponent(imageComp);
                               target.addComponent(queryLabel);
                            }
                        });


I have the following code which gets called in reRender()

Note: I added the remove/add of the component cause I was trying to see if I could make it reload by creating a new image component, and potentially changing the ID, but it still didn't work.

    JFreeChart chart = PlotUtilities.setupChart(query);
        BufferedImage image = chart.createBufferedImage(640, 480, null);

        r.invalidate();
        remove(imageComp);

        r = new BufferedDynamicImageResource();

        r.setImage(image);
        r.setCacheable(false);

        imageComp=new Image("chartimg", r);
        imageComp.setVersioned(true);
        add(imageComp);
        imageComp.modelChanging();
        imageComp.modelChanged();

I have a feeling that this is a browser caching issue and that the Image SRC url may need to have a random number added to it or something to let the browser know the image has changed, or else, the AJAX code needs some kind of special logic to forcefully reload the image.




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to