Domanda

I am using jtable to display data from ms sql server table.
I am able to sort the data using:

TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);    

jtable.setRowSorter(sorter);

The above sorts the data in ascending and descending order.

Is there any such simple function in java to obtain auto filtering of rows as in ms excel?

Thanks in advance

È stato utile?

Soluzione 2

I have used Swing Bits Table Filtering for this: enter image description here

Altri suggerimenti

You may also want to have a look at Coderazzi's TableFilter. It has a permissive MIT license, is available from Central Maven, etc.

Unlike the Swing Bits Table Filtering (referenced in another answer on this page), the Coderazzi TableFilter doesn't mess with the table header. I guess it is a matter of taste.

TableFilter Example

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top