Interface
EditableTableDataSource
Editable Table Data Source
Description
Lets a TableDataSource accept changes made in the table.
Implement it in addition to TableDataSource and the table routes every write - the inline editor, CellTextAt as a setter, adding and removing rows - to the source instead of keeping the value in its own override store. A method that returns False rejects the change, and the table leaves its content untouched.
Methods
Name |
Parameters |
Returns |
Shared |
|---|---|---|---|
index As Integer, parentRow As Integer, depth As Integer, expandable As Boolean, values() As String |
|||
index As Integer |
Method descriptions
EditableTableDataSource.AddRowAt
AddRowAt(index As Integer, parentRow As Integer, depth As Integer, expandable As Boolean, values() As String) As Integer
Insert a row before
index(flat); an out-of-range index appends. Returns the actual index.This example inserts a record and reports where it ended up:
If index < 0 Or index > mRows.LastIndex Then index = mRows.Count Var r As New Record If values.Count > 0 Then r.Name = values(0) mRows.AddAt(index, r) Return index ' the index the row really ended up at
AddRowAt(index As Integer, values() As String) As Integer
Insert a row before
index(flat); an out-of-range index appends. Returns the actual index.
EditableTableDataSource.CellTextAt
CellTextAt(row As Integer, column As Integer, value As String)
Write the cell text back into the source. It is called when the inline editor is committed or when DesktopTable.CellTextAt is assigned. Return False to refuse the change; the table then keeps its content unchanged.
This example accepts an edit in the first column and refuses the others:
If column <> 0 Then Return False ' only the first column may be edited mRows(row).Name = value Return True
EditableTableDataSource.RemoveAllRows
RemoveAllRows
Remove every row. It is called by DesktopTable.RemoveAllRows. Return False to refuse.
This example empties the record store:
mRows.RemoveAll Return True
EditableTableDataSource.RemoveRowAt
RemoveRowAt(index As Integer)
Remove a row including its subtree. The rows below move up, so the table asks for the row count again afterwards.
This example removes a record and refuses an index outside the store:
If index < 0 Or index > mRows.LastIndex Then Return False mRows.RemoveAt(index) Return True
Compatibility
Project Types |
Desktop |
Operating Systems |
All |