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

Fixed sorting in views with TableView instances with no implemented sort #3319

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ public void updateItem(final BondListItem item, boolean empty) {
};
}
});

tableView.getColumns().add(column);
column.setComparator(Comparator.comparing(BondListItem::getAmount));
column.setSortType(TableColumn.SortType.ASCENDING);
tableView.getSortOrder().add(column);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change the default sort order to amount. Atm it is sorted by lockup date and it should stay like that. And all this doesn't work at all as desired as you have applied sorting to a string value which is the default behavior.


column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.lockTime"));
column.setMinWidth(40);
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ public void updateItem(final MyReputationListItem item, boolean empty) {
}
});
tableView.getColumns().add(column);
column.setComparator(Comparator.comparing(MyReputationListItem::getAmount));
column.setSortType(TableColumn.SortType.ASCENDING);
tableView.getSortOrder().add(column);
Comment on lines +315 to +317
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again pointless defining a string to be sorted for as it is the default behavior.


column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.lockTime"));
column.setMinWidth(60);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public void updateItem(final RolesListItem item, boolean empty) {
};
}
});
column.setComparator(Comparator.comparing(RolesListItem::getLockupDate).reversed());
column.setSortType(TableColumn.SortType.ASCENDING);
tableView.getSortOrder().add(column);
Comment on lines +160 to +162
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you sorting this based on lockup date if the name is displayed without any date information displayed. This just makes it confusing for the user.

tableView.getColumns().add(column);

column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.link"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ public void updateItem(final OfferListItem newItem, boolean empty) {
});

tableView.getColumns().add(volumeColumn);
volumeColumn.setComparator(Comparator.comparing(item -> item.offer.getPrice()));
volumeColumn.setSortType(TableColumn.SortType.ASCENDING);
tableView.getColumns().add(volumeColumn);

tableView.getColumns().add(amountColumn);
tableView.getColumns().add(priceColumn);
tableView.getColumns().add(avatarColumn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@

import static bisq.desktop.util.FormBuilder.addButtonAfterGroup;

import java.util.Comparator;

@Slf4j
public class ProposalResultsWindow extends TabbedOverlay<ProposalResultsWindow> {

Expand Down Expand Up @@ -249,6 +251,9 @@ public void updateItem(final VoteListItem item, boolean empty) {
};
}
});
column.setComparator(Comparator.comparing(VoteListItem::getBlindVoteDate));
column.setSortType(TableColumn.SortType.DESCENDING);
votesTableView.getSortOrder().add(column);
votesTableView.getColumns().add(column);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has no effect as the columns are not sortable right now.


column = new AutoTooltipTableColumn<>(Res.get("shared.blindVoteTxId"));
Expand Down