You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/05/18 16:44:45 UTC

svn commit: r1744436 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/

Author: lofwyr
Date: Wed May 18 16:44:45 2016
New Revision: 1744436

URL: http://svn.apache.org/viewvc?rev=1744436&view=rev
Log:
TOBAGO-1504: Optimize tc:suggest for Bootstrap
* implement "delay"

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SuggestTagDeclaration.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-suggest.js

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SuggestTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SuggestTagDeclaration.java?rev=1744436&r1=1744435&r2=1744436&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SuggestTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SuggestTagDeclaration.java Wed May 18 16:44:45 2016
@@ -85,7 +85,7 @@ public interface SuggestTagDeclaration e
    * Time in milli seconds before the list will be requested (by AJAX).
    */
   @TagAttribute
-  @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "300")
+  @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "200")
   void setDelay(String delay);
 
   /**

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-suggest.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-suggest.js?rev=1744436&r1=1744435&r2=1744436&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-suggest.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-suggest.js Wed May 18 16:44:45 2016
@@ -19,7 +19,7 @@ Tobago.Suggest = {};
 
 Tobago.Suggest.loadFromServer = function (input) {
 
-  // var timeout;
+  var timeout;
 
   return function findMatches(query, syncResults, asyncResults) {
 
@@ -27,13 +27,13 @@ Tobago.Suggest.loadFromServer = function
 
     if (suggest.val() != query) {
 
-      // if (timeout) {
-      //   clearTimeout(timeout);
-      // }
+      if (timeout) {
+        clearTimeout(timeout);
+      }
 
-      // var delay = suggest.data("tobago-suggest-delay");
+      var delay = suggest.data("tobago-suggest-delay");
 
-      // timeout = setTimeout(function() {
+      timeout = setTimeout(function() {
         suggest.val(query);
         suggest.data("tobago-suggest-callback", asyncResults);
         suggest.removeData("tobago-suggest-data"); // clear jQuery-data-cache
@@ -48,7 +48,7 @@ Tobago.Suggest.loadFromServer = function
               execute: id,
               render: id
             });
-      // }, delay);
+      }, delay);
 
     }
   };
@@ -65,7 +65,6 @@ Tobago.Suggest.init = function (elements
     var minChars = suggest.data("tobago-suggest-min-chars");
     var maxItems = suggest.data("tobago-suggest-max-items");
 
-    var delay = suggest.data("tobago-suggest-delay"); // todo
     var update = suggest.data("tobago-suggest-update"); // todo
     var totalCount = suggest.data("tobago-suggest-total-count"); // todo