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

Update Table data in the GUI

 
Ravikiran Choppalli
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've completed my GUI. As the application starts, I'm showing all the table data from the db.db file. Now, when I choose any flight and reserve seats on it, the display would'nt update even though I tried the following :
dataBase.modify(freshRecord) ; // MODIFY THE DATABASE

flightDetailTable.tableChanged(new
TableModelEventfbnServicesTableModel)) ;
flightDetailTable.repaint() ;
flightDetailTable.updateUI() ;
Is there any way I can update the data on the GUI as soon as the reservation is done, instead of using the search button to refresh the data displayed.
Any help is appreciated.
Thanks,
Ravi.
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3817
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not clear how you've implemented your table model, but i am assuming it has a vector containing the rows that are being displayed by the table. Now, if you want to refresh the view, then first you have to refresh that vector...may be by executing the same criteriaFind on the server and getting the latest data. And then you should call fireTableDataChanged() or other such methods.
HTH,
Paul.

------------------
Get Certified, Guaranteed!
www.enthuware.com/jqplus

SCJP2 Resources, WebCompiler, Compare Mock Exam Results and More!
www.jdiscuss.com
Your guide to SCJD exam!
www.enthuware.com/jdevplus
 
Ravikiran Choppalli
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could solve it. Actually I was not using Vector to store the values. If so, I could have used DefaultTableModel itself. But I was storing them as String[][] only as it is coming from DataInfo. My mistake was that I was not assigning the data[][] getting from criteriaFind to the localdata[][] of my CustomTableModel. Once I assigned that, the GUI is reflecting my changes.

BUT still, I have a problem. When I reserve the seat at that very moment my GUI is not getting updated. I had to do search again to see the changed data.
Imagine this situation, there were some flights in the display. Now user searches some origin to destination combination for which flights does'nt exist, and the flights in display are not refreshed. Now, the origin and destination you see in the combo boxes are different from the flight being shown in the display. Is this acceptable or do we need to take care of this ?
Thanks,
Ravi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic