使 SuggestionDisplay div 进入正确的位置
在我的 GWT 应用程序中,我有一个 GWT SuggestBox
,用于全文搜索。问题是,当您在显示 SuggestionDisplay
时滚动页面时,结果会随着您滚动而在页面中向下移动。
当我使用 Firebug 检查页面时,我发现文本框的
元素位于正确的位置,但建议显示的
位于正确的位置位于结束
标记上方。将带有 Firebug 的
移动到“包装器”
中,可以根据需要使搜索结果具有粘性(它保留在页面顶部)。如何使建议显示进入正确的位置? SuggestionDisplay
对象没有任何公共方法,我可以使用 DOM 等方式以任何方式操作它。 SuggestBox
构造了它自己的 SuggestionDisplay
,你也可以提供它,但即便如此,我怎样才能让
进入正确的位置?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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,你那里就有答案了。您需要自定义
SuggestionDisplay
。DefaultSuggestionDisplay
使用 PopupPanel,默认情况下将其放置在标记内。然后,您应该将带有建议的 div 放置在您的 SuggestBox 的容器内。
Well you have the answer right there. You need a custom
SuggestionDisplay
. TheDefaultSuggestionDisplay
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.