I've posted something about this before, but it was just a possibility. Now my client decided to see a table (grid) with all data inline, including a button to edit and other button to delete. I was taking a look into TableArrangement, but I've read not so good opinions about it. So, does anyone has an example to create a data table, with these two options (edit and delete)?
Thank you @TIMAI2. They are good options too. But I didn't see in any of them how to put a button (or two in my case) in each row of the table, allowing to edit and delete the line...
In HTML I know it's easy to do, but with TableViewer and CompCreator I didn't see how to do it.
hmmm let me think about it. Maybe it's a good idea. Even the button won't be in each row, but as soon as I click on the item, it could open another screen with buttons... and in this case it won't be necessary a EDIT button, once the click on the item IS for edit...
You will need to "maintain" the record ID if you want to write back any changes to your sqlite DB.
Does your table have to fit the screen, or can it scroll horizontally to view more columns? I assume it will also be OK for your table to scroll vertically....
I set some source data which should represent the query output from sqlite, including the record id. This is needed for writing back an updated record, or deleting a record from the sqlite table. I have not handled this part, but include procedures where additional sqlite blocks can be used.
the source data is tidied up for the table data, removing the id and adding the two icons for each row
I used emojis for the edit and delete icons. It is possible to also use images from local or url sources
You can do more editing to the table format to remove borders as required
I have written code for the Tableviewer click event, so that only the icons generate a response
You can improve the formatting for the edit/update dialog if you wish
This table fits the screen on my phone horizontally, and it will scroll vertically if many more records are added, beyond the height of the screen. You can add further formatting to the table to get a sticky header row.
You can have a choice with this one. Would you prefer to edit a record in place in the displayed list, or do as I have done for Tableviewer and open a dialog?