Fully added filtering and searching!

This commit is contained in:
2023-08-08 10:50:04 -06:00
parent 25730a3324
commit ca86cad950
9 changed files with 164 additions and 174 deletions
+2 -4
View File
@@ -201,18 +201,16 @@ pub struct TableProps<'a, T> {
pub constraints: Vec<Constraint>,
}
fn draw_table<'a, B, T, F, S>(
fn draw_table<'a, B, T, F>(
f: &mut Frame<'_, B>,
content_area: Rect,
block: Block,
table_props: TableProps<'a, T>,
row_mapper: F,
filter_fn: S,
is_loading: bool,
) where
B: Backend,
F: Fn(&T) -> Row<'a>,
S: FnMut(&&T) -> bool,
{
let TableProps {
content,
@@ -221,7 +219,7 @@ fn draw_table<'a, B, T, F, S>(
} = table_props;
if !content.items.is_empty() {
let rows = content.items.iter().filter(filter_fn).map(row_mapper);
let rows = content.items.iter().map(row_mapper);
let headers = Row::new(table_headers)
.style(style_default_bold())