JTable sorter – mkt-data streaming tips

http://stackoverflow.com/questions/996948/live-sorting-of-jtable shows a subtle difference between

fireTableDataChanged(); // triggers re-sort, but ….loses current row selection 😦
fireTableRowsUpdated(0, getRowCount() – 1); // keeps selection 🙂

That’s all about the subtle difference. Here’s a separate issue.

Both of these send some kind of “update” events. To react to them, TableSorter source code reveals a special field —

private boolean sortsOnUpdates; // false by default, so updates to existing rows will NOT trigger re-sort.

http://stackoverflow.com/questions/996948/live-sorting-of-jtable shows a simple fix. This is all you need to add this powerful feature into your trading apps — keep a live table sorted

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s