Interface

# EditableTableDataSource

<div class="rst-class">

forsearch

</div>

Editable Table Data Source

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Lets a `TableDataSource</api/interfaces/tabledatasource>` accept changes made in the table.

Implement it in addition to `TableDataSource</api/interfaces/tabledatasource>` and the table routes every write - the inline editor, <span class="title-ref">CellTextAt</span> 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</api/language/false>` rejects the change, and the table leaves its content untouched.

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                   | Parameters                                                                                                                                                                                                                                | Returns                            | Shared |
|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|--------|
| `AddRowAt<editabletabledatasource.addrowat>`           | index As `Integer</api/data_types/integer>`, parentRow As `Integer</api/data_types/integer>`, depth As `Integer</api/data_types/integer>`, expandable As `Boolean</api/data_types/boolean>`, values() As `String</api/data_types/string>` | `Integer</api/data_types/integer>` |        |
|                                                        | index As `Integer</api/data_types/integer>`, values() As `String</api/data_types/string>`                                                                                                                                                 | `Integer</api/data_types/integer>` |        |
| `CellTextAt<editabletabledatasource.celltextat>`       | row As `Integer</api/data_types/integer>`, column As `Integer</api/data_types/integer>`, value As `String</api/data_types/string>`                                                                                                        |                                    |        |
| `RemoveAllRows<editabletabledatasource.removeallrows>` |                                                                                                                                                                                                                                           |                                    |        |
| `RemoveRowAt<editabletabledatasource.removerowat>`     | index As `Integer</api/data_types/integer>`                                                                                                                                                                                               |                                    |        |

## Method descriptions

<div id="editabletabledatasource.addrowat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

EditableTableDataSource.AddRowAt

**AddRowAt**(index As `Integer</api/data_types/integer>`, parentRow As `Integer</api/data_types/integer>`, depth As `Integer</api/data_types/integer>`, expandable As `Boolean</api/data_types/boolean>`, values() As `String</api/data_types/string>`) As `Integer</api/data_types/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:
>
> ``` xojo
> 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</api/data_types/integer>`, values() As `String</api/data_types/string>`) As `Integer</api/data_types/integer>`

> Insert a row before `index` (flat); an out-of-range *index* appends. Returns the actual *index*.

<div id="editabletabledatasource.celltextat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

EditableTableDataSource.CellTextAt

**CellTextAt**(row As `Integer</api/data_types/integer>`, column As `Integer</api/data_types/integer>`, value As `String</api/data_types/string>`)

> Write the cell text back into the source. It is called when the inline editor is committed or when `DesktopTable.CellTextAt<desktoptable.celltextat>` is assigned. Return `False</api/language/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:
>
> ``` xojo
> If column <> 0 Then Return False ' only the first column may be edited
>
> mRows(row).Name = value
> Return True
> ```

<div id="editabletabledatasource.removeallrows">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

EditableTableDataSource.RemoveAllRows

**RemoveAllRows**

> Remove every row. It is called by `DesktopTable.RemoveAllRows<desktoptable.removeallrows>`. Return `False</api/language/false>` to refuse.
>
> This example empties the record store:
>
> ``` xojo
> mRows.RemoveAll
> Return True
> ```

<div id="editabletabledatasource.removerowat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

EditableTableDataSource.RemoveRowAt

**RemoveRowAt**(index As `Integer</api/data_types/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:
>
> ``` xojo
> If index < 0 Or index > mRows.LastIndex Then Return False
>
> mRows.RemoveAt(index)
> Return True
> ```

## Compatibility

|                       |         |
|-----------------------|---------|
| **Project Types**     | Desktop |
| **Operating Systems** | All     |

<div class="seealso">

`DesktopTable</api/user_interface/desktop/desktoptable>`, `TableDataSource</api/interfaces/tabledatasource>`, `HierarchicalTableDataSource</api/interfaces/hierarchicaltabledatasource>`, `SortableTableDataSource</api/interfaces/sortabletabledatasource>`

</div>
