- Code: Select all
MyTableModel tableModel = new MyTableModel(someData);
SortableTable table = new SortableTable();
QuickTableFilterField filterField = new QuickTableFilterField();
filterField.setTableModel(tableModel);
filterField.setTable(table);
filterField.setColumnIndices(new int[] {0});
table.setModel(filterField.getDisplayTableModel());
Filters are added and work fine.
The problem:
I capture mouse events (mouseRelease) that needs a column and row number to get data from underlying model. When using filters the column and rows that are returned are of the final table that is displayed. For example, I have 10 rows in table and only rows 5 and 6 are displayed after filtering data. Their row number in table is naturally 0 and 1 (as there are now only two rows on the table). When clicking on any of the rows I want their correct number (5 or 6) in my MouseEvent. This gets even trickier when table is sorted.
I get rows in mouseReleased using following code:
- Code: Select all
int tableRow = table.originalRowAtPoint(event.getPoint());
int actualRow = table.getActualRowAt(tableRow);
Any ideas?