TableView Remove Item Error
I am removing selected items from a table view, the table view is a list of maps since my columns are dynamic based on a sql query. I perform the following code the number of rows removed from the table view is not what I expect. I highlight 2 rows and only one is removed when Method 1 is executed, I noticed in the debugger for every item removed from the table view getItems remove method, 2 items are removed from the selected items. When I execute Method 2, then ALL of the items are removed from the table view.
I'm using the JDK 7 update 10.
Method 1:
List<Map> items = tblViewDSResults.getSelectionModel().getSelectedItems();
boolean removed = true;
for (Map item : items)
{
removed = tblViewDSResults.getItems().remove(item);
}
Method 2:
tblViewDSResults.getItems().removeAll(tblViewDSResults.getSelectionModel().getSelectedItems());