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("");
}-*/;
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("");
}-*/;