table: Add default option to perform_sort (#379)
This commit is contained in:
parent
b7a1292d07
commit
db041fea88
2 changed files with 4 additions and 7 deletions
|
|
@ -439,12 +439,9 @@ impl TableDelegate for StockTableDelegate {
|
|||
|
||||
if let Some(col) = self.columns.get_mut(col_ix) {
|
||||
match col.id.as_ref() {
|
||||
"id" => self.stocks.sort_by(|a, b| {
|
||||
if sort == ColSort::Ascending {
|
||||
a.id.cmp(&b.id)
|
||||
} else {
|
||||
b.id.cmp(&a.id)
|
||||
}
|
||||
"id" => self.stocks.sort_by(|a, b| match sort {
|
||||
ColSort::Descending => b.id.cmp(&a.id),
|
||||
_ => a.id.cmp(&b.id),
|
||||
}),
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ where
|
|||
|
||||
let sort = sort.unwrap();
|
||||
let sort = match sort {
|
||||
ColSort::Ascending => ColSort::Descending,
|
||||
ColSort::Ascending => ColSort::Default,
|
||||
ColSort::Descending => ColSort::Ascending,
|
||||
ColSort::Default => ColSort::Descending,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue