Action to delete from iOStable and db table

Hello. I am updating my projects and implementing the new iOS table. In one of my tables, I want to be able to delete a row as well as delete the specific record in the db table. I found there are two example project that I am trying to follow: Table Actions and Table Editing. It looks like both would have methods to accomplish this, but I think it would be better to use the Table Actions example (to swipe left) since Editing has the ability to rearrange the order of the table items, which I am not needing.

After including the ActionsForRow and RowAction in the iOStable and still using my LoadTable method I previously have been using (code below), when I swipe left, no actions come up in the row. I reviewed the Actions example again and see it is using a TableData with various methods and a property. I added this to my project and loaded the data differently than my current method so that it matches how this is performed in the example. With this way, the table actions did show, and I found how to delete from the table and the db table. However, some additional quirks came up. 1) The table has detail text as well, and 2) This table has an action when pushed, it opens another view, so I need to tag the row with the ID number. I kind of found out how to also include the detail text and the row tag, but when the table loads, it is loading the detail and tag for just one of the rows that is displayed in all rows

My first question is, do I have to use the TableData class as in the example, or can I still load the data from the view as in my code below? And if the data can be loaded this way, how do you get the table actions to work when you swipe left?

[code] TestResultsTable.RemoveAll

	'loads the progress data into the listbox and orders by date
	dim sql as Text = "SELECT * FROM progress ORDER BY TestDate DESC"
	dim rs as iOSSQLiteRecordSet
	if rs <> Nil then
			Dim cellData As iOSTableCellData
					While Not rs.EOF
							cellData = TestResultsTable.CreateCell
							cellData.Text = rs.Field("ProgTest").TextValue
							dim d as date = rs.Field("TestDate").DateValue
							cellData.DetailText = d.ToText(Locale.Current, date.FormatStyles.Short, date.FormatStyles.None) + _
							";  " + rs.Field("Score").TextValue
							cellData.AccessoryType = iOSTableCellData.AccessoryTypes.Disclosure
							'tags the cell with ProgID
							cellData.Tag = rs.Field("ProgID").IntegerValue
							'add rows
							TestResultsTable.AddRow(0, cellData)
			End Try
	End If[/code]

My second question is, if I have to use the TableData class as in the example, how do you properly incorporate the correct row’s detail text and the tag so it is displayed correctly and will push to the next view with the appropriate data?

Third question, if the Table Editing example is the one to follow (the one with the Edit button in the navigation bar), how do you make the call to delete from the db table? Does this go into the RowEditingStyle method of the table? Does this way of editing still require the use of the TableData class or could the data be loaded as in my code above and still be edited? Ideally I’d like to maintain the use of my current loading method if possible.


I found the fix. Posting in case anyone else needs this. The following is posted in the RowData method of the TableData class. CreateCell handles the cells’ text and detail text, and if necessary an image and accessory type too

[code] Dim cell As iOSTableCellData = table.CreateCell(Data(row), TestDate(row))
cell.Tag = TagArray(row)

	Return cell[/code]

In the Constructor method, Data, TestDate, and TagArray are all arrays that are being populated by the SQLite syntax