我正在使用SuggestBox让用户选择值。但是,当列表中只有一个值时,我在SuggestBox中设置该值,并且我希望该字段不可编辑。
我正在尝试下面的东西,但现在该组件在UI上不可见。
sgstBox.getTextBox().setEnabled(false);这也不起作用
sgstBox.getTextBox().setReadOnly(true);发布于 2010-06-24 16:40:26
两个未经测试的解决方案found on Google groups
public static void setEnabled(SuggestBox sb,boolean enabled) {
DOM.setElementPropertyBoolean(sb.getElement(), "disabled", !enabled);
} 和
//pass in your own TextBox when you construct the SB:
TextBox tb = new TextBox();
SuggestBox sb = new SuggestBox(oracle, tb);
//...and later disable the TextBox:
tb.setEnabled(false); https://stackoverflow.com/questions/3108152
复制相似问题