Adding scroll to GWT SuggestBox

99封情书 提交于 2019-12-12 10:56:01

问题


Does anyone know how to:

1) Add a scroll to the popup created by the SuggestBox?

2) How to customize the looks (CSS) of the SuggestBox efficiently?

I want to make above changes without touching the actual implementation as much as possible. Also this solution should support (IE7-IE8, FF, Chrome).

Thanks.


回答1:


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.

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;
}



回答2:


2)

new SuggestBox().setStyleName(/* your style here */);



来源:https://stackoverflow.com/questions/4430800/adding-scroll-to-gwt-suggestbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!