Android Tutorial [B4X] B4XTable - Editable table and export to CSV

Discussion in 'Tutorials & Examples' started by Erel, Feb 18, 2019.

  1. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]

    This example shows how to modify the table data. When the user clicks on a cell we show an input dialog and let the user modify its content.

    The data in B4XTable is stored in an in-memory database. The table name is 'data' and the column names are available with B4XTableColumn.SQLID.

    The code to update a cell:
    Code:
    B4XTable1.sql1.ExecNonQuery2($"UPDATE data SET ${column.SQLID} = ? WHERE rowid = ?"$Array As String(InputTemplate.Text, RowId))
    When the window is closed the updated data is saved in a CSV file.

    This is a B4J example, however it should be trivial to port it to B4A or B4i.

    More advanced editable table: https://www.b4x.com/android/forum/threads/b4x-cross-platform-editable-b4xtable-form-example.104766/
     

    Attached Files:

    Last edited: Apr 11, 2019
  2. asales

    asales Well-Known Member Licensed User

    To Android: is possible to have a click in the cell to get the value and a LongClick to edit the cell?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    B4XTable v1.08 adds long click events. It should be simple to implement this with the new event.
     
    asales likes this.
  4. asales

    asales Well-Known Member Licensed User

    Thanks! Works fine.
    The example to Android is in attached.
     

    Attached Files:

  5. Beja

    Beja Expert Licensed User

    Hi
    Thanks Erel for this wonderful and easy to use table. At this time I can't test the example but I am just wondering if it contains the regular editing functions like add row, delete row, find...etc.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    No. Only editing existing cells. It shouldn't be too difficult to add new rows or delete rows.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice