diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersView.java index f9234b65be..80dc38afe6 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersView.java @@ -73,6 +73,7 @@ import javafx.beans.binding.Bindings; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.value.ChangeListener; +import javafx.collections.ListChangeListener; import javafx.collections.transformation.FilteredList; import javafx.collections.transformation.SortedList; @@ -88,6 +89,7 @@ import static bisq.desktop.util.FormBuilder.getRegularIconForLabel; @FxmlView public class OpenOffersView extends ActivatableViewAndModel { + private enum ColumnNames { OFFER_ID(Res.get("shared.offerId")), DATE(Res.get("shared.dateTime")), @@ -136,6 +138,7 @@ public class OpenOffersView extends ActivatableViewAndModel sortedList; private PortfolioView.OpenOfferActionHandler openOfferActionHandler; private ChangeListener widthListener; + private ListChangeListener sortedListeChangedListener; @Inject public OpenOffersView(OpenOffersViewModel model, @@ -224,6 +227,13 @@ public class OpenOffersView extends ActivatableViewAndModel { + c.next(); + if (c.wasAdded() || c.wasRemoved()) { + updateNumberOfOffers(); + } + }; } @Override @@ -231,6 +241,7 @@ public class OpenOffersView extends ActivatableViewAndModel filteredList = new FilteredList<>(model.dataModel.getList()); sortedList = new SortedList<>(filteredList); sortedList.comparatorProperty().bind(tableView.comparatorProperty()); + sortedList.addListener(sortedListeChangedListener); tableView.setItems(sortedList); filterBox.initialize(filteredList, tableView); // here because filteredList is instantiated here @@ -249,7 +260,7 @@ public class OpenOffersView extends ActivatableViewAndModel { CSVEntryConverter headerConverter = item -> { String[] columns = new String[ColumnNames.values().length]; @@ -286,9 +297,14 @@ public class OpenOffersView extends ActivatableViewAndModel