Hi *,

i would like to exchange a panel on another panel. The newly added panel has an AbstractBehavior which adds the script:

    public ReplacementPanel(String id) {
        super(id);
        final Label component;
        add(component = new Label("lblReplaced", "Done"));
        add(new AbstractBehavior() {
            @Override
            public void renderHead(IHeaderResponse response) {
String js = "$(function() {$(document.getElementById(\"" + component.getMarkupId() + "\").style.color=\"red\");});";
                response.renderJavascript(js, "replaced");
                super.renderHead(response);
            }
        });
    }

But if i replace the panel and refresh it's parent on requestTarget, no red style is added to my label.

    public MainPanel(String id) {
        super(id);
        add(new WebMarkupContainer("replaceMe"));
        add(new AjaxLink<Void>("doReplace") {
            @Override
            public void onClick(AjaxRequestTarget target) {
MainPanel.this.addOrReplace(new ReplacementPanel("replaceMe"));
                target.addComponent(MainPanel.this);
            }
        });
        setOutputMarkupId(true);
    }

Is it possible to execute my script in the ajax response?

Thanks for help
Per


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

Reply via email to