Hi,
I have a combo box which got some images as posible values this is done like this:
Code:
private void initializeEditor() {
ComboBox<ComboboxItem> _sizeCombo = new ComboBox<ComboboxItem>();
_sizeCombo.setHideLabel(true);
_sizeCombo.setSize(175, -1);
_sizeCombo.setTriggerAction(TriggerAction.ALL);
_sizeCombo.setDisplayField("text");
_sizeCombo.setEditable(false);
_sizeCombo.setStore(_comboBoxStore);
_sizeCombo.setForceSelection(true);
_sizeCombo.setTemplate(getTemplate(_iconPath));
}
private native String getTemplate(String base) /*-{
return [
'<tpl for=".">',
'<div class="x-combo-list-item"><img src="clear.cache.gif" style="background: url(' + base + '{[values.text]}.png) repeat-x; height: 15px; width: 160px"/></div>',
'</tpl>'
].join("");
}-*/;
private class ComboboxItem extends BaseModelData {
public ComboboxItem(String text) {
setText(text);
}
public String getText() {
return get("text");
}
public void setText(String text) {
set("text", text);
}
}
Now when they select the value (image) in the dropdown i would like the image to be show as the selected value.
How do i do this?
Hope someone are able to help me.
Regards,
Jacob