Monday, September 25, 2017

Re: ListBox how set selected item by value

private void setSelectedValue(ListBox lBox, String str) {
String text = str;
int indexToFind = -1;
for (int i = 0; i < lBox.getItemCount(); i++) {
//Match by Value
if (lBox.getValue(i).equals(text)) {
indexToFind = i;
break;
}
//Match by Text 
                       if (lBox.getItemText(i).equals(text)) {
indexToFind = i;
break;
}
}
lBox.setSelectedIndex(indexToFind);

On Wednesday, May 20, 2009 at 1:02:22 PM UTC+5:30, zeroonea wrote:
when i load data to form to edit, how i set selected item in listbox
by value

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment