Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Indexing JTable

 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In the DataClient class I have modify method :
public void modify(int recNum, int seats, int operatingMode)
When user selects a particular row in JTable I'm calling this method which inturn calls modify method in
Data class. Parameter recNum indicates the row selected in JTable. This works fine if I display all records
from DB. But I think this logic fails when I display selected records based on Search. How do I identify the recNum ?
Do we need to maintain some sort of indexing on JTable ?
Thanks
Dilip
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm not very sure abt how ur stuff works.
I hope you r reading the whole record from the DB, so u must be reading the rec number/ unique key as well?
U might not want to show it in the JTable display but you can definitely read the whole record (from the table model) even during booking and pass the unique key index as rec num.
hope it helps.
karthik.
 
Sam Wong
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can read the entire record including the rec num but exclude it from display with the use of a TableColumnModel. This will allow you to reference and model and get the rec num.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic