Affects Version/s: None
Ti SDK v3.1.3GA
The following tableview displays 20 numbered rows. The tableview is set as "editable:true", so the swipe-to-delete gesture is enabled in iOS. The tableview also has a click event handler, so any row clicked on, will be deleted as well with the TableView.deleteRow() method. The idea is that a user can swipe-to-delete any row, or simply click any row to delete it.
Problem: Swipe-deleting a row, then calling .deleteRow() on a later row causes the display to remove the incorrect row. Seems like Swipe-to-delete is causing an indexing problem with the rows.
1. Load the app.
2. Click on "Row 1" to delete it. This works fine.
3. Swipe-to-delete "Row 2" and delete it. This works fine.
3. Click on "Row 3" to delete it. This fails, and "Row 4" gets deleted instead of "Row 3".
Anytime you swipe-delete a row, any other rows below that one which are deleted with TableView.deleteRow() miss the correct index, instead deleting something farther below their index.
The more swipe-deletes you do, the more the index is offset incorrectly when calling .deleteRow().
Using $.tv.deleteRow(e.index) or $.tv.deleteRow(e.row) does not make a difference.
Here's the code: