How to get the recordNumber when the users selects specfic row in JTable? I am trying to implement the book method in client side and in my AbstractTableModel class i am using Object [][]. joey
Matt DeLacey
Ranch Hand
Joined: Oct 12, 2000
Posts: 318
posted
0
Try getSelectedRow() of class JTable. With Respect, Matt
joey phillip
Ranch Hand
Joined: Jan 22, 2001
Posts: 40
posted
0
Hi Matt ! Thanks for your response
I am talking about DataInfo's recordNumber field(Unique key).
How do you get recorNumber for lock() and unlock()? joey [This message has been edited by joey phillip (edited March 27, 2001).]
Paul Smiley
Ranch Hand
Joined: Jun 02, 2000
Posts: 244
posted
0
You have to keep a hash table or something on the client to hold the record numbers
Are you storing all db records in the hastable or only the records which matches searchcriteria?
Thanks joey
Matt DeLacey
Ranch Hand
Joined: Oct 12, 2000
Posts: 318
posted
0
If you are keeping a vector or some such in your tablemodel, which seems like the way to go to me, then you don't need to explicitly also track the recordnum. You can access it through the DataInfo class. I don't know what you're storing in your Vector, but if you'll just store DataInfos, you can readily access the recordnum. That in conjunction with a getDataAt in your TableModel. Does that answer your question? With Respect, Matt
Matt DeLacey
Ranch Hand
Joined: Oct 12, 2000
Posts: 318
posted
0
But you'll need to get an updated (i.e. from db.db) version using the recordnum else the data might be stale.
joey phillip
Ranch Hand
Joined: Jan 22, 2001
Posts: 40
posted
0
Hi Matt, Yes. I am storing DataInfo objects in Vector. after every search the Vector will be updated with new data and will be populated in JTable. Thanks joey
luis veron
Ranch Hand
Joined: Mar 07, 2001
Posts: 35
posted
0
hello, I think what joey is trying to point here is when you format your table (tablemodel), were not going to include the record number (visible) in the table itself. Only the values, in this case the array of strings in Datainfo (String[] values). I was kind of thinking on including the record number but it should only be in the background. as in invisible? So when you select a row, you only need to get the record number. Though, I haven't started implementing this idea. What do you think guys... regards, luis