| Author |
JTable - Enable filtering but disable sorting
|
Payam Fard
Ranch Hand
Joined: Jan 31, 2003
Posts: 65
|
|
Hi all,
I have a jtable for which I would like to have filtering capabilities but disable sorting. Right now, I can filter the values shown in the table but user can also click on the table header to sort the values. How I can disable sorting while keeping the filtering?
Thanks.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
|
To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.
Also, read the API for DefaultRowSorter -- there's a method that determines whether each column is sortable.
|
luck, db
There are no new questions, but there may be new answers.
|
 |
Payam Fard
Ranch Hand
Joined: Jan 31, 2003
Posts: 65
|
|
How can I disable sorting on the following code while keeping the filtering?
http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/components/TableFilterDemoProject/src/components/TableFilterDemo.java
Thanks.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
|
1. Where's that SSCCE?
2. How many methods are declared in the DefaultRowSorter class?
3. Of those, how many are mutators?
4. What does each of those mutators set?
|
 |
Kelly Nichols
Greenhorn
Joined: Aug 23, 2012
Posts: 1
|
|
|
Did you figure out how to solve this problem? I too would like to filter out some rows, but not have the table sorted when you click the header. I was thinking about resorting to a glass pane over the headers.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
|
The answer to this one is still the same:
Darryl Burke wrote:... read the API for DefaultRowSorter -- there's a method that determines whether each column is sortable.
|
 |
 |
|
|
subject: JTable - Enable filtering but disable sorting
|
|
|