[
https://issues.apache.org/jira/browse/WICKET-2909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jeremy Thomerson updated WICKET-2909:
-------------------------------------
Attachment: quickstart.tar.gz
quickstart demonstrating behavior
commit for fix will follow at first opportunity
> ListView removeLink method should remove items from list based on item index
> ----------------------------------------------------------------------------
>
> Key: WICKET-2909
> URL: https://issues.apache.org/jira/browse/WICKET-2909
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.9
> Reporter: Clint Checketts
> Assignee: Jeremy Thomerson
> Priority: Minor
> Attachments: quickstart.tar.gz
>
>
> 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()
> {
>
> ((List<T>)getList()).add(oldIndex, removedObject);
> }
> });
> 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.