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

I update database but how to refresh JTable

 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using AbstractTableModel
I update the database it works find but I have to manually do another search to see the new database available seats.
I try using model.fireTableDataChanged();
I need to refresh the Jtable manually when I book, but I would like it to do it asap when I book
help please
Thanks Lisa
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The assignment doesn't require for the clients view of the data to be in sync with the database.
If you want to update a row on your table, After you have updated the object collection in your abstract table model, call one of the following:
fireTableDataChanged();
fireTableRowsUpdated( index, index );
The sencond one should be better and more efficient if you'd like to update a single row only...
Hope this helps!!!
Benjam�n

[This message has been edited by Benjam�n Amodio (edited May 09, 2001).]
[This message has been edited by Benjam�n Amodio (edited May 09, 2001).]
 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I feel it is better to do a new search whenever you you need to display records since other user may have booked on the database. I assume you lock the database while you do the up-dating only.
If you just update you user interface without get information from the database, the display may not be a real presentation of the database. The information is not upto-date.
Therefore it makes more sense to do a new search everytime of the display.
Please Comment.
Ruilin
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to agree it makes alot of sense because the info can be deceptive to other onlookers if I just refresh the GUI good Point
Lisa
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic