Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
If ColumnId <> "Customer Id" Then Return
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
DeleteRow(B4XTable1, RowId)
End If
End Sub
Sub DeleteRow (tbl As B4XTable, RowId As Long)
Dim RowData As Map = tbl.GetRow(RowId)
Dim customerID As String = RowData.Get("Customer Id")
tbl.sql1.ExecNonQuery2("DELETE FROM data WHERE rowid = ?", Array (RowId)) 'deletes record from Table
oSQL.ExecNonQuery2("DELETE FROM customers WHERE customerID = ?", Array (customerID)) 'deletes from DB
Dim page As Int = tbl.CurrentPage
Dim FirstIndex As Int = tbl.FirstRowIndex
tbl.ClearDataView 'Updates the rows count.
If FirstIndex + 1 >= tbl.mCurrentCount Then
page = page - 1
End If
tbl.CurrentPage = page
End Sub