Programmably sort table

is there a way to programmably sort a table?

Do you mean programmatically affect the table’s built-in sort (like emulating a user clicking on the headers) or programmatically sort the data with your own algorithm?

just for display purposes. so it would be just like clicking the heading.

Sure, you can do something like this:

To sort ascending:

table = event.source.parent.getComponent("Table") table.getModel().sortByColumn(3, 1)

Or to sort descending:

table = event.source.parent.getComponent("Table") table.getModel().sortByColumn(3, 0)

where “3” is the index of the column you want to sort by.

Hope this helps,