Hi,

 I'm developing a component that needs to call a javascript function
after it's rendered (throw and AJAX update or a normal request).

 I get it running like this:

    @Override
    protected void onBeforeRender() {
        super.onBeforeRender();
        AjaxRequestTarget target =
RequestCycle.get().find(AjaxRequestTarget.class);
        if (target != null) {
             target.appendJavaScript( getInitJavaScript() );
        }
    }

    @Override
    public void renderHead(IHeaderResponse response) {
        response.render(JavaScriptHeaderItem.forScript(
                "Wicket.Event.add(window, \"load\", function(event) {
" + getInitJavaScript() + " });",
                "load-codemirror-js")
        );
    }

But, Is there a better way?

Thanks!

-- 
a10! i fins aviat.
J:-Deu

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

Reply via email to