I have a powertable on the form in the window called XYZ_Images. This powertable does have a DB table as a source. In this table, records are being written (sometimes few per Minute, sometimes no record written for half an hour). The SELECT ORDERs BY timestamp descending (most recent row should be the first in the table). I’d like to refresh the powertable with client script every 10 seconds and in case new record has been added, I’d like to select programatically first row. I’ve done this:
It’s possible that the selectedRow modification is happening before the table repopulates with data - try wrapping it in an invokeLater so that it happens after the rest of the processing on the event dispatch thread.
Nope, it does not work anyway. The behavior is still the same new record is being loaded, but it is not selected programatically. However, after discussing this feature with the users, they came to concluson they don’t need it, therefore I don’t need the solution to this problem. However, Thank you Paul for the effort. Take care.
I recall playing with these events and noted that assignment to data would generate events on both data and selectedRow, like so: -1 => selectedRow, newdata => data, previously selected row => selectedRow. So to change the selected row on a data event, the assignment had to be deferred until after the internal reset of the selected row back to its previous value. I haven’t investigated the event order for the Table lately, but you might want to put some print statements in your propertyChange script to see what’s happening, and in what order.