View Full Version : XComboBox and CheckBoxListView

14 Mar 2011, 11:25 AM

Ive been searching threads about this issue and Ive found some posts where its said that he issue about not being able to make selections from XcomboBox (via setSelection) is due to CheckBoxListView. Im using GXT 2.2.1 and it still doesnt work. Any help?


14 Mar 2011, 4:26 PM
After trying for a while Ive found a workaround for this issue. Not elegant at all, but it works (at least in my tests ;) ). Probably Im doing something wrong but here is my temporal solution:

We add a method in "XComboBox", in order to being able to execute a protected method of ComboBox.

public void triggerBlur() {

We create a method where the values are set:

public void doIt(){
DeferredCommand.addCommand(new Command()

public void execute()

The deferred command is necessary because of triggerBlur (which its invoked to lose the focus on the grid). The 'trick' is expand the combo, so now, its rendered and the CheckBoxListView sets right the values.

15 Mar 2011, 1:37 AM
Just another tip Ive realized:

As implemented, ModelData passed to setSelection must be in the store of the comboBox. So in a case like you get values for your comboBox, and then you wanna set some of those values because an object has them (for example, a form where you wanna modify an existing object), its necessary to find the model in the store (because to set it true it HAS to be the same object).
A method for doing that would be:

public void setSelection(List<D> selection, String key) {

ListStore<D> tempStore = getStore();
for (D d : selection) {

((CheckBoxListView<D>) getView()).setChecked(
tempStore.findModel(key, d.get(key)), true);