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.

Bug 99144 - Sample Ajax auto complete renders incorrectly inside of a page fragment
Summary: Sample Ajax auto complete renders incorrectly inside of a page fragment
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Matthew Bohm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-27 15:21 UTC by Lark Fitzgerald
Modified: 2007-09-25 21:05 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lark Fitzgerald 2007-03-27 15:21:13 UTC
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.
Comment 1 Lark Fitzgerald 2007-03-27 15:39:13 UTC
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 
Comment 2 Matthew Bohm 2007-06-27 01:39:22 UTC
Accepting.
Comment 3 Matthew Bohm 2007-07-02 22:10:41 UTC
The proposed fix appears to work. I intend to incorporate it.
Comment 4 Matthew Bohm 2007-07-02 23:32:39 UTC
Fix is available in most recent ui-0.1.2.complib.
Comment 5 Lark Fitzgerald 2007-09-25 21:05:15 UTC
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