Thursday, May 27, 2010

GWT List box help

Hi,

I am having issue with GWT List box. I want to move the selected item
from one list box to other list box.After adding into the other
listbox , i am removing from the source.But it is not working as
expected. can you please let me know what needs to corrected in this
code.


Code:

ListBox source = new ListBox(true);
ListBox destination = new ListBox(true);

for (int i = 0; i < 5; ++i) {
source.add(i);
}

onchange event, I am doing the following:

for (int i = 0; i < source.getItemCount(); ++i) {

if (source.isItemSelected(i)) {
destination.addItem(source.getItemText(i));
source.removeItem(i);
}
else
{
GWT.log("non selected Item : " + source.getItemText(i)) ;
}
}

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment