Ok so for those who'll encounter the same problem, I solved it myself through experimenting, and I found out that the baseList
is actually a list of String where the FilterList
will do its filtering job. To do my requirement, I just added the column value that I need to be filtered to the baseList
parameter.
The following code will filter the table based on the combobox selected index coming from the view.
public void getFilterStrings(List baseList, E element) {
JComboBox cbo = view.getCboSearch();
int selIndex = cbo.getSelectedIndex();
Person p = (Person) element;
if(selIndex == 0)
baseList.add(p.getFirstName());
else if(selIndex == 1)
baseList.add(p.getLastName());
else if(selIndex == 2)
baseList.add(p.getBirthDay());
else if(selIndex == 3)
baseList.add(p.getAge());
else if(selIndex == 4)
baseList.add(p.getOccupation());
}