PDA

View Full Version : ComboBox selection is not visible



jagadeesh9.k
25 Jan 2012, 2:35 AM
I am using gxt ComboBox , in the field drop down it is showing values, but when i select a value from the drop down list it is now visible(disappearing). Here i am using setTemplate(), is there any problem with this. Please suggest me.

Thanks in advance.

Code:

private void configureComboBox() {
templateCombo.setEmptyText("Select a state...");
templateCombo.setDisplayField("name");
templateCombo.setTemplate(getTemplate(WYGCityWithStateModel.cityField,
WYGCityWithStateModel.cityStateField));
templateCombo.setWidth(150);
templateCombo.setStore(store);
templateCombo.setTypeAhead(true);
templateCombo.setTriggerAction(TriggerAction.ALL);
}

private native String getTemplate(String stateFieldName,
String cityFieldName) /*-{
return [
'<tpl for=".">',
'<div class="x-combo-list-item">{values.' + cityFieldName
+ '} ({values.' + stateFieldName + '})</div>', '</tpl>' ]
.join("");
}-*/;

Ersmarker
30 Jan 2012, 6:29 AM
The ComboBox will display the value from difined by

templateCombo.setDisplayField("name");
I guess you don't have that property in your ModelData
Try changing to:


templateCombo.setDisplayField(WYGCityWithStateModel.cityStateField);