Description
In org.apache.wicket.markup.html.list.ListView the removeLink() method removes and object from the underlying list using the modelObject. instead it should remove using the item.getIndex().
Reason: if the listview's model contains several nulls, and the clicked item's object is null then the first null would get removed instead of the entry at the item that was actually clicked.
Instead of: 'final int oldIndex = getList().indexOf(item.getModelObject());' use the passed in item.getIndex()
Example:
public void onClick()
{
addStateChange(new Change()
{
private static final long serialVersionUID = 1L;
final int oldIndex = item.getIndex()); <- Change here ///////////////////////////////
final T removedObject = item.getModelObject();
@Override
public void undo()
});
item.modelChanging();
// Remove item and invalidate listView
getList().remove(oldIndex); <- Change here ///////////////////////////////
ListView.this.modelChanged();
ListView.this.removeAll();
}
I spoke with Jeremy Thomerson about this. Please assign to him. The moveUpLink and MoveDownLink are similarly affected.