Looking for advice, and direction as well. Using 7.9.10, MySQL. I have a table with several rows that I allow changes. Right now you don’t edit the from within table, yet with selected row I move data into dropdown boxes, text boxes, etc. Then they enter values here and hit submit, which just writes back to the table. This is fine except it can be cumbersome as they have to save each row at a time. Is it possible to copy the table to another dataset, then have them edit this dataset and when they are ready to copy the entire dataset back to the table?
Why not have your dropdowns, text boxes, etc write back to the table dataset with setValueAt?
Then at the end have a button that loops the table and writes the changes to the database?
This should not be used on any dataset that is referenced anywhere. You won't get propertyChange events and references will be changed behind the backs of other instances. Datasets are defined to be immutable for a reason.
Thanks guys, the table is bound to a SQL query. Is it a good idea to copy the table to another dataset, use it to edit, then send back to the table?
If you're going the two-dataset route, this thread my help you out.
IMO, it would be less hassle to make the table editable, and write back to the db using onCellEdited (assuming Power Table).
Is there a reason not to edit directly in the original table and just have it write back to the database as the edits are done? You can still create drop downs for data selection in the table and do a table refresh after the data is written so you know it gets to the database.
In my experience editing directly has been a little flaky, especially with dropdowns, perhaps something I had done wrong. However, what I haven’t been able to get is validation, how do you do bounds, meaning clamp entries from a min/max?