Author: jleroux
Date: Fri Apr  6 09:48:29 2012
New Revision: 1310266

URL: http://svn.apache.org/viewvc?rev=1310266&view=rev
Log:
A patch from Deepak Dixit for "Auto-completer request should be async." 
https://issues.apache.org/jira/browse/OFBIZ-4780

Fixes a minor issue regarding the pending request count for ajax 
auto-completer: pending count is used to add and remove the 
ui-autocomplete-loading class. If we are aborting the request then this count 
is not updated properly and ui-autocomplete-loading class does not remove from 
the lookup element hence ajax loader image display continuously if response 
came.

Modified:
    ofbiz/trunk/framework/images/webapp/images/selectall.js

Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1310266&r1=1310265&r2=1310266&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Fri Apr  6 09:48:29 
2012
@@ -418,9 +418,11 @@ function ajaxAutoCompleter(areaCsvString
                     data: {term : request.term},
                     beforeSend: function (jqXHR, settings) {
                         //If LAST_AUTOCOMP_REF is not null means an existing 
ajax auto-completer request is in progress, so need to abort them to prevent 
inconsistent behavior of autocompleter
-                        if (LAST_AUTOCOMP_REF != null) {
+                        if (LAST_AUTOCOMP_REF != null && 
LAST_AUTOCOMP_REF.readyState != 4) {
                             var oldRef = LAST_AUTOCOMP_REF;
                             oldRef.abort();
+                            //Here we are aborting the LAST_AUTOCOMP_REF so 
need to call the response method so that auto-completer pending request count 
handle in proper way
+                            response( [] );
                         }
                         LAST_AUTOCOMP_REF= jqXHR;
                     },


Reply via email to