Author: musachy Date: Sat Jun 21 07:04:10 2008 New Revision: 670200 URL: http://svn.apache.org/viewvc?rev=670200&view=rev Log: WW-2669 Autocompleter options list element does not resize correctly
thanks to Aner Perez for the patch Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js?rev=670200&r1=670199&r2=670200&view=diff ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js (original) +++ struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js Sat Jun 21 07:04:10 2008 @@ -39,7 +39,7 @@ this.formId = this.cbox.formId; this.formFilter = this.cbox.formFilter; this.transport = this.cbox.transport; - + this.getData = function(/*String*/ url){ //show indicator dojo.html.show(this.cbox.indicator); @@ -58,7 +58,7 @@ if(!this.firstRequest || type == "error") { this.cbox.notify.apply(this.cbox, [data, type, evt]); } - + this.firstRequest = false; var arrData = null; var dataByName = data[dojo.string.isBlank(this.cbox.dataFieldName) ? this.cbox.name : this.cbox.dataFieldName]; @@ -84,7 +84,7 @@ arrData = data[key]; break; } else { - //if nathing else is found, we will use values in this + //if nathing else is found, we will use values in this //object as the data tmpArrData.push([key, data[key]]); } @@ -98,7 +98,7 @@ arrData = tmpArrData; } } - + data = arrData; } this.setData(data); @@ -106,7 +106,7 @@ mimetype: "text/json" }); }; - + this.startSearch = function (searchStr, callback) { // FIXME: need to add timeout handling here!! this._preformSearch(searchStr, callback); @@ -270,15 +270,15 @@ //embedded the style in the template string in 0.4.2 release, not good templateCssString: null, templateCssPath: dojo.uri.dojoUri("struts/ComboBox.css"), - + //how many results are shown searchLimit : 30, - + transport : "", - + //load options when page loads preload : true, - + //from Dojo's ComboBox showResultList: function() { // Our dear friend IE doesnt take max-height so we need to calculate that on our own every time @@ -297,6 +297,8 @@ var totalHeight = this.itemHeight * childs.length; if(totalHeight < this.dropdownHeight) { this.optionsListNode.style.height = totalHeight + 2 + "px"; + } else { + this.optionsListNode.style.height = this.dropdownHeight + "px"; } this.popupWidget.open(this.domNode, this, this.downArrowNode); @@ -387,22 +389,22 @@ if(!dojo.string.isBlank(this.notifyTopics)) { this.notifyTopicsArray = this.notifyTopics.split(","); } - + //before topics if(!dojo.string.isBlank(this.beforeNotifyTopics)) { this.beforeNotifyTopicsArray = this.beforeNotifyTopics.split(","); } - + //after topics if(!dojo.string.isBlank(this.afterNotifyTopics)) { this.afterNotifyTopicsArray = this.afterNotifyTopics.split(","); } - + //error topics if(!dojo.string.isBlank(this.errorNotifyTopics)) { this.errorNotifyTopicsArray = this.errorNotifyTopics.split(","); } - + //value topics if(!dojo.string.isBlank(this.valueNotifyTopics)) { this.valueNotifyTopicsArray = this.valueNotifyTopics.split(","); @@ -449,7 +451,7 @@ } }); } - + //before, after and error topics var topicsArray = null; switch(type) { @@ -464,10 +466,10 @@ break; case "valuechanged": this.notifyTo(this.valueNotifyTopicsArray, [this.getSelectedValue(), this.getSelectedKey(), this.getText(), this]); - break; + break; } }, - + notifyTo : function(topicsArray, params) { var self = this; if(topicsArray) { @@ -480,7 +482,7 @@ }); } }, - + log : function(text) { dojo.debug("[" + (this.widgetId ? this.widgetId : "unknown") + "] " + text); }, @@ -501,7 +503,7 @@ this._startSearch(searchStr); } }, - + setSelectedKey : function(key) { var data = this.dataProvider.data; for(element in data) { @@ -512,15 +514,15 @@ } } }, - + getSelectedKey : function() { return this.comboBoxSelectionValue.value; }, - + getSelectedValue : function() { return this.comboBoxValue.value; }, - + getText : function() { return this.textInputNode.value; }