You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "Bob Schellink (JIRA)" <ji...@apache.org> on 2009/05/27 19:29:46 UTC

[jira] Resolved: (CLK-517) Controls using addLoadEvent does not work with Ajax

     [ https://issues.apache.org/jira/browse/CLK-517?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bob Schellink resolved CLK-517.
-------------------------------

    Resolution: Fixed

fixed in trunk as part of JsScript implementation. For Ajax requests the "addLoadEvent" won't be rendered (Ajax requests doesn't trigger the DOM loaded event), instead the JavaScript payload will be evaluated immediately.

> Controls using addLoadEvent does not work with Ajax
> ---------------------------------------------------
>
>                 Key: CLK-517
>                 URL: https://issues.apache.org/jira/browse/CLK-517
>             Project: Click
>          Issue Type: Improvement
>          Components: core, extras
>            Reporter: Bob Schellink
>            Assignee: Bob Schellink
>             Fix For: 2.1.0
>
>
> When loading a page with Ajax, control callbacks registered with addLoadEvent won't fire because the DOM ready event has already occurred.
> One solution is to expose the following method on ClickUtils:
> public static JsScript createAddLoadEvent() {
>     JsScript script = new JsScript() {
>         public void renderContent(HtmlStringBuffer buffer) {
>             if (getContext().isAjaxRequest()) {
>                 buffer.append("if (typeof(Click) != 'undefined')");
>                 buffer.append("    if (typeof(Click.domready) != 'undefined')");
>                 buffer.append("Click.domready.ready = true;");
>             }
>             super.renderContent(buffer);
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.