Added sorting to the main library table

This commit is contained in:
2024-02-13 23:00:35 -07:00
parent a982f610cb
commit 6cd24be5e4
13 changed files with 707 additions and 117 deletions
+7 -1
View File
@@ -218,8 +218,14 @@ where
}
pub fn apply_sorting(&mut self) {
self.apply_sorting_toggle(true);
}
pub fn apply_sorting_toggle(&mut self, toggle_dir: bool) {
if let Some(sort_options) = &mut self.sort {
self.sort_asc = !self.sort_asc;
if toggle_dir {
self.sort_asc = !self.sort_asc;
}
let selected_sort_option = sort_options.current_selection();
let mut items = self.filtered_items.as_ref().unwrap_or(&self.items).clone();
if let Some(cmp_fn) = selected_sort_option.cmp_fn {