[Jifty-commit] r1347 - in jifty/trunk: share/web/static/js share/web/static/js/scriptaculous

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jun 22 11:57:00 EDT 2006


Author: trs
Date: Thu Jun 22 11:57:00 2006
New Revision: 1347

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/share/web/static/js/jifty.js
   jifty/trunk/share/web/static/js/scriptaculous/controls.js

Log:
 r13301 at zot:  tom | 2006-06-22 11:40:29 -0400
 Set minChars to 0 and show the autocomplete onFocus.  This allows the user's autocomplete code to decide if it wants to show anything for the cases where there's no current value.  As long as the autocompleters are written with this in mind, I don't think it'll be a performance problem.


Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js	(original)
+++ jifty/trunk/share/web/static/js/jifty.js	Thu Jun 22 11:57:00 2006
@@ -801,8 +801,7 @@
     this.action = Form.Element.getAction(this.field);
     this.url    = '/__jifty/autocomplete.xml';
 
-
-    this.baseInitialize(this.field, $(div));
+    this.baseInitialize(this.field, $(div), { minChars: "0" });
   },
 
   getUpdatedChoices: function() {

Modified: jifty/trunk/share/web/static/js/scriptaculous/controls.js
==============================================================================
--- jifty/trunk/share/web/static/js/scriptaculous/controls.js	(original)
+++ jifty/trunk/share/web/static/js/scriptaculous/controls.js	Thu Jun 22 11:57:00 2006
@@ -74,6 +74,7 @@
 
     Element.hide(this.update);
 
+    Event.observe(this.element, "focus", this.onFocus.bindAsEventListener(this));
     Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
     Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this));
   },
@@ -174,7 +175,17 @@
     setTimeout(this.hide.bind(this), 250);
     this.hasFocus = false;
     this.active = false;     
-  }, 
+  },
+
+  onFocus: function(event) {
+    this.changed = true;
+    this.hasFocus = true;
+
+    if (this.observer)
+        clearTimeout(this.observer);
+    
+    this.onObserverEvent();
+  },
   
   render: function() {
     if(this.entryCount > 0) {


More information about the Jifty-commit mailing list