On 20 mai, 09:32, zeroonea <
Zeroo...@gmail.com> wrote:
> when i load data to form to edit, how i set selected item in listbox
> by value
Loop over the items until you find the one you want to select, and set
it selected (though depending on whether you have a multiple-selection-
enabled ListBox or not, and/or whether you'd like to clear the current
selection or add to it --in case ismultipleSelect() == true--, you'd
use setItemSelected vs. setSelectedIndex).
GWT could have provided a "shortcut" method (setSelectedValue or
selectByValue) but it would do exactly this, as there's no other way
of doing it at the JS-level (and it would probably result in less-
optimized code, as developers would be using this shortcut method
instead of trying to optimize their own algorithm a bit; denpending on
their use case, multiple selection vs. single selection, replace
selection vs. add to selection, etc.).