Skip to content

Commit

Permalink
Add show_search and show_quick_filters to ui.table
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrunyon committed May 11, 2024
1 parent ce1a019 commit fe98def
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions plugins/ui/src/deephaven/ui/components/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def table(
on_cell_double_press: CellPressCallback | None = None,
on_column_press: ColumnPressCallback | None = None,
on_column_double_press: ColumnPressCallback | None = None,
show_search: bool = False,
show_quick_filters: bool = False,
) -> UITable:
"""
Customization to how a table is displayed, how it behaves, and listen to UI events.
Expand All @@ -40,6 +42,8 @@ def table(
The first parameter is the column name.
on_column_double_press: The callback function to run when a column is double clicked.
The first parameter is the column name.
show_search: Whether to show the search bar by default.
show_quick_filters: Whether to show the quick filter bar by default.
"""
props = locals()
del props["table"]
Expand Down
9 changes: 6 additions & 3 deletions plugins/ui/src/js/src/elements/UITable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ function UITable({
onColumnDoublePress,
onRowPress,
onRowDoublePress,
canSearch,
filters,
sorts,
alwaysFetchColumns,
table: exportedTable,
showSearchBar,
showQuickFilters,
}: UITableProps): JSX.Element | null {
const dh = useApi();
const [model, setModel] = useState<IrisGridModel>();
Expand Down Expand Up @@ -114,15 +115,17 @@ function UITable({
() => ({
mouseHandlers,
alwaysFetchColumns,
showSearchBar: canSearch,
showSearchBar,
sorts: hydratedSorts,
quickFilters: hydratedQuickFilters,
isFilterBarShown: showQuickFilters,
settings,
}),
[
mouseHandlers,
alwaysFetchColumns,
canSearch,
showSearchBar,
showQuickFilters,
hydratedSorts,
hydratedQuickFilters,
settings,
Expand Down
3 changes: 2 additions & 1 deletion plugins/ui/src/js/src/elements/UITableUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export interface UITableProps {
onColumnPress?: (columnName: ColumnName) => void;
onColumnDoublePress?: (columnName: ColumnName) => void;
alwaysFetchColumns?: string[];
canSearch?: boolean;
filters?: Record<string, string>;
sorts?: DehydratedSort[];
showSearchBar?: boolean;
showQuickFilters?: boolean;
[key: string]: unknown;
}

Expand Down

0 comments on commit fe98def

Please sign in to comment.