tags:

views:

48

answers:

1

I am using SuggestBox to let user to select values. But however when there is only one value in the list, I am setting the value in the SuggestBox and I want this field to be non-editable.

I am trying below things, but now the component is not visible on UI.

sgstBox.getTextBox().setEnabled(false);

this is not working either

sgstBox.getTextBox().setReadOnly(true);
+1  A: 

Two not tested solutions found on Google groups:

public static void setEnabled(SuggestBox sb,boolean enabled) {
                DOM.setElementPropertyBoolean(sb.getElement(), "disabled", !enabled);
} 

and

//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); 
DrDro
Thanks DrDro, will try it.
Reddy
Handling DOM element is working fine. Didn't try second one.Thank you.
Reddy