GWT Suggestbox with Smartgwt

2020-02-13 01:53发布

I am facing a problem that I can't see the drop down list of the GWT Suggestbox. I am adding a GWT Suggestbox into SmartGWT's VLayout. Then I can see the textbox of the Suggestbox. But when I input some data, I can't see the suggestions provided. Is this because I am using the SmartGWT VLayout? Could anyone tell me how to solve it? Thanks.


Sorry, the above question is not clear enough. What I mean is I add a SuggestBox into a layout with small height. Then I can see the the SuggestBox's TextBox part and part of the suggestion and the rest of the suggestion seems hide under other layout. Below is my code:

VLayout mainLayout = new VLayout();
mainLayout.setHeight100();
mainLayout.setWidth100();

MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
oracle.add("a");
oracle.add("aa");
oracle.add("aaa");
oracle.add("aaaa");
oracle.add("aaaaa");
oracle.add("aaaaaa");
oracle.add("aaaaaaa");
SuggestBox box = new SuggestBox(oracle, new TextBox());
VLayout suggestBoxLayout = new VLayout(); 
suggestBoxLayout.setHeight("10%");
suggestBoxLayout.addMember(box);


VLayout body = new VLayout();
body.setBackgroundColor("#3B5998");
body.setHeight("90%");

mainLayout.addMember(body);
mainLayout.addMember(suggestBoxLayout);        

So when I enter a into the SuggestBox, I can only see a, aa, aaa and the rest suggestions are hide by the body.

标签: gwt smartgwt
3条回答
看我几分像从前
2楼-- · 2020-02-13 02:24

It would be easier with little bit of code. Before stopping to mix Smartgwt with Gwt I integrated some code which was using GWt suggestBox and it was working.... (Why don't you use the Smartgwt selectitem it does the job?) Regards

Alain

查看更多
三岁会撩人
3楼-- · 2020-02-13 02:25

With the help from Alain, I add .gwt-SuggestBoxPopup {z-index: 1000000;} into my CSS. Then I solve the problem.

查看更多
疯言疯语
4楼-- · 2020-02-13 02:48

This may be zIndex related, but there's no reason to use GWT's SuggestBox and run into problems like this. Use SmartGWT's ComboBoxItem. If you don't want a drop-down control to appear at the end of the text entry area, call setShowPickerIcon(false).

查看更多
登录 后发表回答