You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Johan Compagner (JIRA)" <ji...@apache.org> on 2008/06/02 12:07:45 UTC

[jira] Closed: (WICKET-1659) Prolem with 'mouseactive' in wicket-autocomplete.js when AutoCompleteBehaviour is added (twice) during Ajax roundtrip

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

Johan Compagner closed WICKET-1659.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-M3
                   1.3.4

applied it also for 1.4

> Prolem with 'mouseactive' in wicket-autocomplete.js when AutoCompleteBehaviour is added (twice) during Ajax roundtrip
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1659
>                 URL: https://issues.apache.org/jira/browse/WICKET-1659
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.4-M1
>            Reporter: Roland Huss
>            Assignee: Johan Compagner
>            Priority: Minor
>             Fix For: 1.3.4, 1.4-M3
>
>
> There is a subtle problem, with the way how the autocomplete menu is created lazily in wicket-autocomplete.js when 
> the AbstractAutoCompleteBehaviour is used dynamically in Ajax roundtrips e.g. for adding addition auto complete
> fields dynamically.
> The auto complete menu is added as an addition <div> to the document and stays there even after an Ajax roundtrip, so 
> the <div> is reused, as well as mouse event listeners on the menu:
> function getAutocompleteMenu() {
>     var choiceDiv=document.getElementById(getMenuId());
>     if (choiceDiv==null) {
>        var container = document.createElement("div");
>        ....
>        container.onmouseout=function() {
>           mouseactive=0;
>        };
>        container.onmousemove=function() {
>           mouseactive=1;
>        }
> };
> However, since Wicket.AutoComplete get initialized a second time for during the Ajax update, a new mouseactive variable is created, which 
> is used in the closures for tweaking the even handling (onChange(), onBlur()), which never gets updated by these reused container (and hence
> is always 0).
> One simple solution to this problem is to cleanup the autocomplete menu in the initialize() if present:
> function initialize(){
>  
>     // Remove the autocompletion menu if still present from
>     // a previous call. This is required to properly register
>     // the mouse event handler again (using the new stateful 'mouseactive'
>     // variable which just gets created)
>     var choiceDiv=document.getElementById(this.getMenuId());
>     if (choiceDiv != null) {
>         choiceDiv.parentNode.parentNode.removeChild(choiceDiv.parentNode);
>     }
>     .....
> }

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