[otrs-cvs] otrs/var/httpd/htdocs/js Core.Agent.CustomerInformationCenterSearch.js, 1.8, 1.9

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/var/httpd/htdocs/js
In directory lancelot:/tmp/cvs-serv19418/var/httpd/htdocs/js

Modified Files:
	Core.Agent.CustomerInformationCenterSearch.js 
Log Message:
Fixed bug#8990 - Autocompletion returns stale requests.

Author: mn

Index: Core.Agent.CustomerInformationCenterSearch.js
===================================================================
RCS file: /home/cvs/otrs/var/httpd/htdocs/js/Core.Agent.CustomerInformationCenterSearch.js,v
retrieving revision 1.8
retrieving revision 1.9
diff -2 -u -d -r1.8 -r1.9
--- Core.Agent.CustomerInformationCenterSearch.js	15 Nov 2012 08:42:19 -0000	1.8
+++ Core.Agent.CustomerInformationCenterSearch.js	27 Dec 2012 12:32:44 -0000	1.9
@@ -47,5 +47,5 @@
      * @return nothing
      */
-    TargetNS.InitAutocomplete = function ( $Input, Subaction ) {
+    TargetNS.InitAutocomplete = function ($Input, Subaction) {
         $Input.autocomplete({
             minLength: Core.Config.Get('Autocomplete.MinQueryLength'),
@@ -63,7 +63,16 @@
                     MaxResults: Core.Config.Get('Autocomplete.MaxResultsDisplayed')
                 };
-                Core.AJAX.FunctionCall(URL, Data, function (Result) {
 
+                // if an old ajax request is already running, stop the old request and start the new one
+                if ($Input.data('AutoCompleteXHR')) {
+                    $Input.data('AutoCompleteXHR').abort();
+                    $Input.removeData('AutoCompleteXHR');
+                    // run the response function to hide the request animation
+                    Response({});
+                }
+
+                $Input.data('AutoCompleteXHR', Core.AJAX.FunctionCall(URL, Data, function (Result) {
                     var Data = [];
+                    $Input.removeData('AutoCompleteXHR');
                     $.each(Result, function () {
                         Data.push({
@@ -73,5 +82,5 @@
                     });
                     Response(Data);
-                });
+                }));
             },
             select: function (Event, UI) {
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.