Interface

iOSTableDataSourceEditing


Warning

This item was deprecated in version 2020r2. Please use iOSMobileTableDataSourceEditing as a replacement.

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 iOSTableDataSource.

Methods

Name

Parameters

Returns

Shared

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 iOSTable.RowEditingStyles

RowIsEditable

table As iOSMobileTable, section As Integer, row As Integer

Boolean

SectionCount

table As iOSMobileTable

Integer

SectionTitle

table As iOSMobileTable, section As Integer

String

Method descriptions


iOSTableDataSourceEditing.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.


iOSTableDataSourceEditing.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 iOSTableCellData instance and populate it with the values from your data source to return it from this method.


iOSTableDataSourceEditing.RowEditingCompleted

RowEditingCompleted(table As iOSMobileTable, section As Integer, row As Integer, action As iOSTable.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 iOSTable.RowEditingStyle 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 = iOSTable.RowEditingStyles.Delete Then
  Var sectionRows() As Integer = mSections.Value(section)
  sectionRows.Remove(row)
  table.RemoveRow(section, row)
End If

iOSTableDataSourceEditing.RowIsEditable

RowIsEditable(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 iOSTable.RowEditingStyle 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

iOSTableDataSourceEditing.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.


iOSTableDataSourceEditing.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 iOSTable is made editable (by setting iOSTable.IsEditing = True): * The data source's RowIsEditable 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.