Sub Globals
Private lRowID As Long '<<<< added
'etc.
End Sub
Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
Dim RowData As Map = B4XTable1.GetRow(RowId)
Dim cell As String = RowData.Get(ColumnId)
'This is the SQLite ROWID of the underlying table, corresponding with the clicked row and we can use this to delete a row
lRowID = RowId '<<<< added
Activity.Title = cell
End Sub
Sub btnDeleteRow_Click
B4XTable1.sql1.ExecNonQuery2("delete from data where rowid = ?", Array As String(lRowID))
B4XTable1.CountAll = B4XTable1.CountAll - 1
B4XTable1.Refresh
End Sub
Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
Dim sf As Object = xui.Msgbox2Async("Delete row?", "Title", "Yes", "Cancel", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
B4XTable1.sql1.ExecNonQuery2("DELETE FROM data WHERE rowid = ?", Array (RowId))
Dim first As Int = B4XTable1.FirstRowIndex
B4XTable1.ClearDataView
B4XTable1.FirstRowIndex = first
End If
End Sub
Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
Dim sf As Object = xui.Msgbox2Async("Delete row?", "Title", "Yes", "Cancel", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
B4XTable1.sql1.ExecNonQuery2("DELETE FROM data WHERE rowid = ?", Array (RowId))
Dim first As Int = B4XTable1.FirstRowIndex
B4XTable1.ClearDataView
B4XTable1.FirstRowIndex = first
End If
End Sub
Not sure that code is quite OK.
In the mentioned example, go to the last page and keep deleting the very last row.
You will see that the last page keeps showing one row with data. This row has moved over from the
previous page.