Skip to content

Impossible to select first value of MaterialListValueBox using setValue() #538

@hajo70

Description

@hajo70

The problem is the that values.indexOf(value) returns 0 for the first value, thus the (index > 0) is false. To work around this bug I created the following subclass:

public class MaterialListValueBoxPatch extends MaterialListValueBox {
@OverRide
public void setValue(T value, boolean fireEvents) {
int index = values.indexOf(value);
if (index >= 0) {
T before = getValue();
setSelectedIndex(index);

        if (fireEvents) {
            ValueChangeEvent.fireIfNotEqual(this, before, value);
        }
    }
}

}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions