Autocompleter options list element does not resize correctly
------------------------------------------------------------
Key: WW-2669
URL: https://issues.apache.org/struts/browse/WW-2669
Project: Struts 2
Issue Type: Bug
Components: Plugin - Dojo Tags
Affects Versions: 2.1.2
Reporter: Aner Perez
The sx:autocompleter has code in place to resize the div which contains the
options based on the number of items in the list.
The div starts out at 120px by default but if the list of items uses less than
120 pixels, it resizes the div to fit the available data (i.e. makes it
smaller).
The problem is that the code never expands the size of the div if the list of
items grows once more. If you have an autocompleter which starts out with 1
item in it, the div (once displayed) will be resized to fit 1 item. If you
refresh the list of items in the autopcompleter to have more than 1 item, the
div is still displayed with a height appropriate for 1 item. This makes it
seem like there is only 1 item in the list.
The offending code is at line 529 of
src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js :
---- original code ---
var totalHeight = this.itemHeight * childs.length;
if(totalHeight < this.dropdownHeight) {
this.optionsListNode.style.height = totalHeight + 2 + "px";
}
--- original code ---
This should be:
--- fixed code ---
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";
}
--- fixed code ---
Now the div correctly handles the height increase when more items are added to
the list.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.