Skip to content

Commit

Permalink
add a create_effect to make sure external changes to the sorting sign…
Browse files Browse the repository at this point in the history
…al are reflected in the table rendering.

closes #40
  • Loading branch information
maccesch committed Jun 5, 2024
1 parent ee73925 commit ce6e3a6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/table_content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ where
let load_row_count = load_row_count.clone();

move |clear_row_count: bool| {
logging::log!("clear");
selection.clear();
first_selected_index.set(None);

Expand All @@ -247,22 +248,23 @@ where
}
}

set_reload_count.set(reload_count.get().overflowing_add(1).0);
set_reload_count.set(reload_count.get_untracked().overflowing_add(1).0);
}
};

let on_head_click = {
let on_head_click = move |event: TableHeadEvent| {
sorting.update(move |sorting| sorting_mode.update_sorting_from_event(sorting, event));
};

create_effect({
let rows = Rc::clone(&rows);
let clear = clear.clone();

move |event: TableHeadEvent| {
sorting.update(move |sorting| sorting_mode.update_sorting_from_event(sorting, event));

move |_| {
rows.borrow_mut().set_sorting(&sorting.get());

clear(false);
}
};
});

create_effect({
let rows = Rc::clone(&rows);
Expand Down

0 comments on commit ce6e3a6

Please sign in to comment.