You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2005/12/22 21:55:33 UTC

svn commit: r358626 - in /myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource: default/theme.css myFaces.js

Author: matzew
Date: Thu Dec 22 12:55:27 2005
New Revision: 358626

URL: http://svn.apache.org/viewcvs?rev=358626&view=rev
Log:
MYFACES-871

Modified:
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/default/theme.css
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/default/theme.css
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/default/theme.css?rev=358626&r1=358625&r2=358626&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/default/theme.css (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/default/theme.css Thu Dec 22 12:55:27 2005
@@ -5,6 +5,8 @@
  }
  .ajaxPopup li {
     white-space: nowrap;
+    padding-left: 3px;
+    padding-right: 3px;
  }
 .ajaxPopup li.selected {
     background-color: #ffb;

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js?rev=358626&r1=358625&r2=358626&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js Thu Dec 22 12:55:27 2005
@@ -2,17 +2,28 @@
 Ajax.MyFacesAutocompleter.prototype = Object.extend(new Autocompleter.Base(),
 Object.extend(new Ajax.Base(), {
   initialize: function(element, update, url, options) {
-	  this.base_initialize(element, update, options);
+	  this.baseInitialize(element, update, options);
     this.options.asynchronous = true;
     this.options.onComplete   = this.onComplete.bind(this)
     this.options.method       = 'post';
     this.url                  = url;
+    this.options.onShow       =
+        function(element, update){
+          if(!update.style.position || update.style.position=='absolute') {
+            update.style.position = 'absolute';
+            var offsets = Position.cumulativeOffset(element);
+            update.style.top    = (offsets[1] + element.offsetHeight) + 'px';
+            update.style.left   = offsets[0] + 'px';
+//            Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});
+          }
+          Effect.Appear(update,{duration:0.15});
+        };    
   },
 
   getUpdatedChoices: function() {
   	Element.addClassName(this.element, "myFacesInputSuggestAjaxThrobbing");
     entry = encodeURIComponent(this.element.name) + '=' +
-      encodeURIComponent(this.getEntry());
+      encodeURIComponent(this.getToken());
 
       this.options.parameters = this.options.callback ?
         this.options.callback(this.element, entry) : entry;
@@ -23,6 +34,15 @@
   onComplete: function(request) {
 	Element.removeClassName(this.element, "myFacesInputSuggestAjaxThrobbing");
     this.updateChoices(request.responseText);
+    this.resetWidth();
+  },
+
+  resetWidth: function() {
+    this.update.style.width = this.element.offsetWidth + 'px';
+    var offset = this.iefix ? 2 : -8;
+    if ((this.update.scrollWidth + offset) > this.element.offsetWidth) {
+      this.update.style.width = (this.update.scrollWidth + offset) + 'px';
+    }
   }
 
 }));