Help with getting the correct recnum for book seats method

Charu Krishnan

Greenhorn

Posts: 19

posted 15 years ago

I have the table model - FBNTable and myData is an instance of data class. I am having problems with getting the correct recnum. When I click on book seats button , I try to pick up the row selected from the GUI and then do a getRecord to get the record number. here is some code from the action performed method int rowSelected = FBNTable.getSelectedRow(); DataInfo di = myData.getRecord(rowSelected); int recnum = di.getRecordNumber();

The problem is that after I have done a search filter and for eg the GUI may have just 4 records, so rowSelected value is now 3 if my mouse has selected the 3rd record. Now when I press the book seats button, the getRecord method uses a value of 3 for row selected, and is therefore pointing to the wrong record. The 3rd record in the GUI could have been actually the 20th record in the database. So how can I get to the correct record to pick up its recnum. Any help will be much appreciated. Thanks Charu

Well in your example, how do you know it is the 20th record. Now take that knowledge, whether you know it from your head, our it is in the code, but basically, you have your Data Model for the Table, why couldn't it also include the actual record number. You don't even have to have it display in the table, but you get the selected row, and see what is in the record number for that row. Or have a matching array that only holds record numbers. Mark