Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to clear all filters #73

Closed
Bridua98 opened this issue Feb 1, 2021 · 3 comments
Closed

How to clear all filters #73

Bridua98 opened this issue Feb 1, 2021 · 3 comments
Labels

Comments

@Bridua98
Copy link

Bridua98 commented Feb 1, 2021

I need to clear all columns filters before reload my JTable data. There are a way to do this?

@eugener
Copy link
Owner

eugener commented Feb 1, 2021

Model changes should reset it. Take a look at

private void listenForModelChange() {
table.addPropertyChangeListener("model", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
clearDistinctItemCache();
listenForDataChange( (TableModel) e.getNewValue() );
}
});
}
private void listenForDataChange(TableModel model) {
if (model != null) {
model.addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
clearDistinctItemCache();
}
});
}
}

@eugener eugener closed this as completed Feb 1, 2021
@blasferna
Copy link
Contributor

blasferna commented Feb 2, 2021

I have the same question, i need to clear all filters programmatically like clicking Clear all column filters PopupWindow button because when clearing all model data the filters remain.

image

I tried clearing the data in different ways but the filters are still in the table.

@eugener
Copy link
Owner

eugener commented Feb 2, 2021

I don't believe this functionality is exposed through API, even though it exists internally.
PRs are always welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants