Make the SuggestionDisplay div go into the correct position

416 views Asked by At

In my GWT app I have a GWT SuggestBox which I use for a full text search. The problem is that when you scroll in the page while SuggestionDisplay is shown, the results move down the page as you scroll.

When I use Firebug to inspect the page, I see that the text box's <div> element is in the correct place, but the suggestion display's <div> sits right above the closing </body> tag. Moving the <div> with Firebug into the "wrapper" <div> makes the search results sticky as desired (it stays at the top of page).

How can I make the suggestion display go into the right position? SuggestionDisplay objects do not have any public methods I can use to manipulate it in any way using the DOM or so. SuggestBox constructs it's own SuggestionDisplay, and you can provide it too, but even so, how can I make the <div> go into the correct position?

1

There are 1 answers

2
Strelok On

Well you have the answer right there. You need a custom SuggestionDisplay. The DefaultSuggestionDisplay uses a PopupPanel, which is placed inside the <body> tag by default. Yours should place the div with suggestions inside the container of your SuggestBox then.