JTable row filters updates

Is there a way to tell a JTable's row filter that it should update itself to display the filtered data? I'm currently using the fireTableDataChanged method in the AbstractTableModel but the underlying data for the table isn't actually changing, so this seems like it might be wasteful. The way my filter works is to check if data in the table is in some other list and only display it if it is in that list. So that other list changed and I need to tell the filter to refresh itself. Is fireTableDataChanged the correct way to do this?

thanks, Jeff

Answers


fireTableDataChanged IS a correct way to do it.

I would consider the "other list" a part of your data. That means it should be a part of your table model. So whenever it changes the model should call fireTableDataChanged. This will do the trick.

If you cannot make it a part of your model it at least should notify the model when change happened and then model will call fireTableDataChanged. For notification you can use standard listeners approach or if you prefer global approach Event Bus framework can be of help .


Need Your Help

Format XAML UserControl and Window attributes on seperate line

wpf xaml visual-studio-2013

In Visual Studio, I would like to configure the formatter such that UserControl or Window tags have their attributes on separate lines, but all other types have their attributes on the same line.

Setting self.view.frame after going back does not work

ios iphone objective-c uiview uitableview

I am setting the UITableViewController's frame in viewDidAppear as follows: