• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Filter ResultSet in JTable

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable in my application that displays the data in a ResultSet. I also gave the user the ability to filter this list by some of the fields (user,jobNumber, etc).

Currently the filter causes another database query with a WHERE clause then updates the JTable using model.setResultSet(rs) and model.fireTableDataChanged() calls with the new ResultSet.

Since the original list contains all of the records I would like to avoid hitting the database a second time just to hide some of the records and a third time just to show what I had originally!

Is there a way to allow filtering of a ResultSet in a JTable without replacing the ResultSet?

Thanks!
 
Popeye has his spinach. I have this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic