nmasilva
7 Jun 2009, 2:37 PM
Hi all
I'm using the M2 of new version 2 of the GXT and i have a problem retrieving the select value from a combo box.
Here is my combobox:
comboClubes = new ComboBox<ClubeLabelValueDTO>();
comboClubes.setDisplayField("nome");
comboClubes.setValueField("indice");
comboClubes.setWidth(150);
comboClubes.setTemplate(getTemplate());
comboClubes.setEditable(false);
comboClubes.setTypeAhead(false);
comboClubes.setTriggerAction(TriggerAction.ALL);
comboClubes.setStore(new ListStore<ClubeLabelValueDTO>());
comboClubes.setPropertyEditor(new ListModelPropertyEditor<ClubeLabelValueDTO>() {
public String getStringValue(ClubeLabelValueDTO value) {
return value.getNome();
}
});
comboClubes.getView().setModelProcessor(new ModelProcessor<ClubeLabelValueDTO>() {
public ClubeLabelValueDTO prepareData(ClubeLabelValueDTO model) {
model.set("name", model.getNome());
return model;
}
});
To make a programatic selection the only way i've found is:
public void setClubesComboBoxValue(final ClubeLabelValueDTO item) {
comboClubes.setSelection(Arrays.asList(new ClubeLabelValueDTO[] {item}));
}
And to retrieve the selection:
comboClubes.getSelection().size() is 0
thanks in advance
Nuno
I'm using the M2 of new version 2 of the GXT and i have a problem retrieving the select value from a combo box.
Here is my combobox:
comboClubes = new ComboBox<ClubeLabelValueDTO>();
comboClubes.setDisplayField("nome");
comboClubes.setValueField("indice");
comboClubes.setWidth(150);
comboClubes.setTemplate(getTemplate());
comboClubes.setEditable(false);
comboClubes.setTypeAhead(false);
comboClubes.setTriggerAction(TriggerAction.ALL);
comboClubes.setStore(new ListStore<ClubeLabelValueDTO>());
comboClubes.setPropertyEditor(new ListModelPropertyEditor<ClubeLabelValueDTO>() {
public String getStringValue(ClubeLabelValueDTO value) {
return value.getNome();
}
});
comboClubes.getView().setModelProcessor(new ModelProcessor<ClubeLabelValueDTO>() {
public ClubeLabelValueDTO prepareData(ClubeLabelValueDTO model) {
model.set("name", model.getNome());
return model;
}
});
To make a programatic selection the only way i've found is:
public void setClubesComboBoxValue(final ClubeLabelValueDTO item) {
comboClubes.setSelection(Arrays.asList(new ClubeLabelValueDTO[] {item}));
}
And to retrieve the selection:
comboClubes.getSelection().size() is 0
thanks in advance
Nuno