Interface

iOSMobileTableDataSourceEditing


Description

A data source to use to enable editing of iOSTable data. When a table is put into "edit mode", the user can use the insertion and deletion editing controls to add or remove rows from the table and its data source. Aggregates iOSMobileTableDataSource.

Methods

Name

Parameters

Returns

Shared

AllowRowEditing

table As iOSMobileTable, section As Integer, row As Integer

Boolean

RowCount

table As iOSMobileTable, section As Integer

Integer

RowData

table As iOSMobileTable, section As Integer, row As Integer

MobileTableCellData

RowEditingCompleted

table As iOSMobileTable, section As Integer, row As Integer, action As iOSMobileTable.RowEditingStyles

SectionCount

table As iOSMobileTable

Integer

SectionTitle

table As iOSMobileTable, section As Integer

String

Method descriptions


iOSMobileTableDataSourceEditing.AllowRowEditing

AllowRowEditing(table As iOSMobileTable, section As Integer, row As Integer) As Boolean

Asks the data source if the specified row can be edited. Most data sources that implement this interface will unconditionally return True.

The specific type of edit that is allowed (None, Insert or Delete) is specified in the iOSMobileTable.RowEditingStyles event.

To allow row actions to work you must Return True from this method.

In most cases, you will return True for this method to allow the row to be edited:

Return True

iOSMobileTableDataSourceEditing.RowCount

RowCount(table As iOSMobileTable, section As Integer) As Integer

Return the number of rows for the section.

Your class should return the number of rows in your data source for this section. For example, if you are showing a list of names in sections for the first letter of the last name, then this method would return the number of names in the specified section.


iOSMobileTableDataSourceEditing.RowData

RowData(table As iOSMobileTable, section As Integer, row As Integer) As MobileTableCellData

The actual cell data for the section and row.

You will need to create an MobileTableCellData instance and populate it with the values from your data source to return it from this method.


iOSMobileTableDataSourceEditing.RowEditingCompleted

RowEditingCompleted(table As iOSMobileTable, section As Integer, row As Integer, action As iOSMobileTable.RowEditingStyles)

Tells the data source that the user wants a row inserted or removed. The data source should update its internal state and inform the table of its changes. Data sources must not alter the table's editing state from within this method.

The specific type of edit that is allowed (None, Insert or Delete) is specified in the iOSMobileTable.ApplyRowEditingStyle event.

If the user deleted a row, then remove it from the mSections Dictionary property used by the data source and remove it from the table:

If action = iOSMobileTable.RowEditingStyles.Delete Then
  Var sectionRows() As Integer = mSections.Value(section)
  sectionRows.Remove(row)
  table.RemoveRow(section, row)
End If

iOSMobileTableDataSourceEditing.SectionCount

SectionCount(table As iOSMobileTable) As Integer

Return the number of sections.

You should return the total number of sections in your data source. For example, if you are displaying names with sections for each letter of the alphabet, then you might return 26 here.

If you are not using sections, you can return 1 since there always needs to be at least one section.


iOSMobileTableDataSourceEditing.SectionTitle

SectionTitle(table As iOSMobileTable, section As Integer) As String

Return the title for the section.

If you are not using sections, you can return empty text ("") here.

When using sections, return the name for the specified section. For example, if you are displaying names with sections for each letter of the alphabet, you might return "A" when section of 0 is passed in as a parameter.

Notes

Any data source that supports deletion and insertion of rows or that uses row actions must implement this interface.

When the iOSMobileTable is made editable (by setting iOSMobileTable.IsEditing = True):

  • The data source's AllowRowEditing method is called for the visible rows and the editable rows get reordering controls.

  • The user taps on a row's delete or insert button.

  • The data source's RowEditingCompleted method is called so the data source can update its internal state.

Compatibility

iOS projects on the iOS operating system.