I have a DAO that removes rows from a DB table. I have a GUI table representing some of those rows that passes user requests for deletion to that DAO
How should I update the GUI table?
I could attach a listener that listens on successful deletions and deletes a corresponding GUI row on each of them. I'm not 100% comfortable with a DAO registering listeners, tbh. Besides, updating GUI on each deletion may backlog the event queue a bit, I reckon
I could make the DAO return a collection of deleted rows' ids and then iterate over it and delete GUI rows in my widget class. Theoretically, only some of the submitted rows can be successfully deleted, that's why I can't iterate over all submitted ids. I'm inclined to pick this option but have doubts
I can refresh the entire table once everything is over. The table data is not expected to be huge, so this option is tempting for its simplicity. However, I'm not sure I should rely on that as a developer. If the data is big, it's going to be costly
Or, I guess, I could do something else
What is the right approach?