happens if items is a SortedList, to reproduce in the modified example below,
- edit first item (in the view, that is "data item 99") and commit
expected: the item at that first line is updated
is: the item at the very bottom (of the view, that is previous "data item 1") is updated
culprit is the default commit handler, which sets the item of the bottommost source with the index of the sorted. Must do an index mapping to the coordinate system of the bottom-most before setting.
Modify the example ofRT-15205 and add the following:
Comparator<String> comparator = new Comparator<String> (){
Comparator collator = Collator.getInstance();
@Override
public int compare(String o1, String o2) {
return - collator.compare(o1, o2);
}
};
SortedList<String> sorted = new SortedList(data, comparator);
list.setItems(sorted);
- edit first item (in the view, that is "data item 99") and commit
expected: the item at that first line is updated
is: the item at the very bottom (of the view, that is previous "data item 1") is updated
culprit is the default commit handler, which sets the item of the bottommost source with the index of the sorted. Must do an index mapping to the coordinate system of the bottom-most before setting.
Modify the example of
Comparator<String> comparator = new Comparator<String> (){
Comparator collator = Collator.getInstance();
@Override
public int compare(String o1, String o2) {
return - collator.compare(o1, o2);
}
};
SortedList<String> sorted = new SortedList(data, comparator);
list.setItems(sorted);