I created a TableRowSorter
for a JTable
, and I was able to sort the table correctly. But is there a way to get the table back to its original state before I sorted it? I tried clicking on the table header, but it seems that it only sorts the table in ascending or descending order, and it doesn't return the table back to its original state prior to the sort. Is it possible to un-sort the table and get it back to its original state? Thanks!
Empty sortKeys
list indicates the view should be unsorted. Try the following to restore original row order:
table.getRowSorter().setSortKeys(null);
Read more in RowSorter spec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With