editable Table with one empty ghost row at the end (for adding new rows)

Hello
I have a table that displays rows from a database using a simple TableQuery.
I need this table to be editable, and I would like to be able to add rows just typing in the last empty ghost row, at the end of the table.
I should display one more row, empty, that does not exist in the database, in order for the table to be able to accept the new inserted text. When this row starts to contain data, a new empty row should be added at the end of the table again.

could I do this using TableQuery, or I need to handle the data on my own?

Has anybody did something like this? do you have any suggestions?

best regards
Yorgos Tryfon

Hi,

this sounds a bit tricky to me. I think the safest solution would be to just have “Add” and “Save” buttons which would call addItem() and commit() on the SQLContainer.

One way you could try this is to extend the SQLContainer, override its refresh() method and do a call to super.refresh() and then a call to addItem(). This way you should always have an empty row at the end. However, this still does not provide the auto-saving you probably want too, so you would still need a “Save” button which would call commit() on the container, eventually call refresh and create a new empty row at the bottom.