将滚动添加到GWT SuggestBox
有谁知道如何:
1)在SuggestBox创建的弹出式窗口中添加滚动条?
1) Add a scroll to the popup created by the SuggestBox?
2)如何有效地自定义SuggestBox的外观(CSS)?
2) How to customize the looks (CSS) of the SuggestBox efficiently?
我想做的上面的更改,而不触及实际的实现尽可能多。
此解决方案应该支持(IE7-IE8,FF,Chrome)。
I want to make above changes without touching the actual implementation as much as possible. Also this solution should support (IE7-IE8, FF, Chrome).
谢谢。
使用Firebug addon for Firefox(或IE / Chrome调试器)来检查您需要修改其样式的元素,并查看GWT是否已为其分配了样式类名称[或读取其JavaDoc] 。这里在你的情况下,它的gwt-SuggestBoxPopup外部元素和许多其他样式类名称为内部元素,如suggestPopupMiddle,suggestPopupMiddleCenterInner和suggestPopupContent。
Use Firebug addon for Firefox (or IE/Chrome debugger) to inspect the element you need to modify its style and see if GWT has assigned it a style class name [or read its JavaDoc]. Here in you case its gwt-SuggestBoxPopup for outer element and lots of other style class names for inner elements like suggestPopupMiddle, suggestPopupMiddleCenterInner and suggestPopupContent. Use this class names to modify components style.
要添加垂直(水平)滚动,您需要指定height(width)或max-height,并使用overflow-y:scroll ; (overflow-x:scroll;)或overflow:scroll;
To add vertical (horizontal) scroll you need to specify height (width) or max-height and use overflow-y: scroll; (overflow-x: scroll;) or overflow: scroll; Use auto instead of scroll to hide the scollbar when not necessary.
因此,您的简短回答是:
So your short answer is:
.suggestPopupContent{
height: 100px;
overflow-y: scroll;
}