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 2006/01/04 21:49:47 UTC
svn commit: r365980 -
/myfaces/sandbox/trunk/src/main/resources/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js
Author: matzew
Date: Wed Jan 4 12:49:43 2006
New Revision: 365980
URL: http://svn.apache.org/viewcvs?rev=365980&view=rev
Log:
MYFACES-871
Modified:
myfaces/sandbox/trunk/src/main/resources/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js
Modified: myfaces/sandbox/trunk/src/main/resources/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/main/resources/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js?rev=365980&r1=365979&r2=365980&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/main/resources/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js (original)
+++ myfaces/sandbox/trunk/src/main/resources/org/apache/myfaces/custom/inputsuggestajax/resource/myFaces.js Wed Jan 4 12:49:43 2006
@@ -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';
+ }
}
}));