This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
5.5 Sample Ajax auto complete renders incorrectly inside of a page fragment steps: 1. Add a automcomplete textfield to page1 2. Create page fragment 3. open page fragment and add autocomplete textfield to page fragment 4. double click textfield and uncomment the two commands result.addItem("Hello"); result.addItem(prefix.toUpperCase()); 5. dpeloy The autocomplete pulldown menu is displayed as a textfield size space below the component instead of right below the original text field. If you put the component inside of a plan div it renders below the div. The autocomplete component displays properly when its not in a page fragment. When put in a plan div on a regular page it does not appear to work at all.
comments from Chrys: I debugged this issue down to the fact that the autocomplete text field is in a div. The javascript code that the complete popup window uses to get the x and y display coordinates seems to have a bug. The popup window's position is set relative to its container yet the javascript sets the position relative to the top of the document. This makes the popup display off by the sum of the x and y offsets of all the parent containers. The javascript code is in ui.jar META-INF/autocomplete/script.js this._y = function() { var element = this.target; var y = 0; while (element) { if (element.offsetParent) { y += element.offsetTop; } else if (element.y) { y += element.y; } element = element.offsetParent; } return y; } I changed it to this and it seems to work correctly. this._y = function() { var element = this.target; var y = 0; if (element.offsetParent) { y += element.offsetTop; } else if (element.y) { y += element.y; } return y; } I made the same changes to this._x = function() as well. Chrys
Accepting.
The proposed fix appears to work. I intend to incorporate it.
Fix is available in most recent ui-0.1.2.complib.
Verified using AJAX BluePrints 0.1.2 complib. Product Version: NetBeans 6 IDE Dev (Build beta1: 200709250000 System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb) Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b02 Glassfish: 58g Woodstock 4.1: 200709201029