GeeCON Prague 2014*
The moose likes JDBC and the fly likes Another DefaultTableModel post Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Another DefaultTableModel post" Watch "Another DefaultTableModel post" New topic
Author

Another DefaultTableModel post

Przemek Wisniewski
Greenhorn

Joined: Sep 28, 2009
Posts: 2
Hi Everybody,

I've got the MySQL "Database" with one table and just a few records in it. I am able to display all the records just fine using "select * from..". However, once displayed when i try to filter/search for something the from the table, I want only the relevant rows to be left/displayed in a table. I am also using the DefaultTableModel's insertRow() method. But it just appends the record in the first row. And it seems like there's no "clear()" method, so I tried to creat new(another) DefaultTableModel inside my search method in order to clear the previous (select * from..) but still no luck.. I have no idea why it won't work. I thought that when i setModel() again it should refresh display? What am I doing wrong?
Przemek Wisniewski
Greenhorn

Joined: Sep 28, 2009
Posts: 2
Calling setRowCount(0) has solved the issue.
 
GeeCON Prague 2014
 
subject: Another DefaultTableModel post