Hello, I have found another bug ralated to the ComboBoxItem, when selecting a filter option that have an icon and after returning to the default option, that does not have an icon, the last selected icon is displayed.
Test case:
Steps to reproduces the bug:
1 - Select a value with icon in the filter combobox;
2 - Select the deafult value (empty value);
3 - Now you can see the icon be displayed for the empty value
I think the bug is somewhere in the code below, because when the value is null, it should not use the last value.
SmartClient Version: v9.1p_2014-05-05/LGPL Development Only (built 2014-05-05)
Test case:
Code:
public class LabSmart implements EntryPoint {
/**
* This is the entry point method.
*/
@Override
public void onModuleLoad() {
Page.setTitle("Coluns");
Page.setAppImgDir("[SKIN]/");
VLayout layout = new VLayout();
layout.setPadding(5);
layout.setWidth100();
layout.setHeight100();
layout.addMember(getGrid());
layout.draw();
}
private Canvas getGrid() {
ListGrid grid = new ListGrid();
grid.setShowFilterEditor(true);
ListGridField icon = new ListGridField("icon", "Icon", 150);
icon.setValueMap(getValues());
icon.setValueIcons(getIcons());
ListGridField name = new ListGridField("name", "Name");
grid.setFields(icon, name);
return grid;
}
private Map<String, String> getValues() {
LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
values.put("0", "Não informado");
values.put("1", "Ativo");
values.put("2", "Inativo");
return values;
}
private Map<String, String> getIcons() {
LinkedHashMap<String, String> icons = new LinkedHashMap<String, String>();
icons.put("1", "images/ImgButton/button_Over.png");
icons.put("2", "images/ImgButton/button_Disabled.png");
return icons;
}
}1 - Select a value with icon in the filter combobox;
2 - Select the deafult value (empty value);
3 - Now you can see the icon be displayed for the empty value
I think the bug is somewhere in the code below, because when the value is null, it should not use the last value.
Code:
// FormItem.js
// _updateValueIcon
// Explicitly updates the valueIcon image src based on the data value passed in.
_updateValueIcon : function (value) {
if (this.suppressValueIcon || !this.isDrawn()) return;
if (value == null) value = this.getValue();
var src = this._getValueIcon(value),
valueIconHandle = this._getValueIconHandle();
...