Posted Friday, December 28, 2007 @ 12:16:17
You need to implement this your own.
First get the tableheader of Quicktable
dbTable.getTable().getTableHeader();
Add a mouse click listener to the header. By default quicktable will sort the rows when you click on column header. To prevent that, set dbtable.setSortEnabled(false);
when mouseclicked, identify the column which is clicked.
Then find all distinct values in that column. There are two approaches to do this.
1) Every time, go through all rows of that column and using dbtable.getValueAt(), get the values of the cell and store in a 'Set'(Collection) to make them unique. Using this set object create a combobox and show to users.
2) First time when you load data, go through all cells and using dbtable.getValueAt(), get the values and store them in a 'Set' object per column. Any time when users make any change to any cell, update the appropriate column Set. Use a DBTableCellListener
to listen for cell value changes.
Once user selects a value to filter by that value, use the dbtable filter method
dbTable.filter(1 /*column id*/, DBTable.EQUAL /*criteria*/, value /*filter value*/)