-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Picker - Table support for key + label columns (#1876)
Initial table support for Picker - key and value column support - Scroll to selected item when popover opens - Viewport data now supports re-use of existing item objects via `reuseItemsOnTableResize` flag ## Testing ### Scroll to item fix for non-table data (this should work without any changes to plugins repo) ```python import deephaven.ui as ui from deephaven.ui import use_state items = list("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") @ui.component def picker(): value, set_value = use_state("M") # Picker for selecting values pick = ui.picker( label="Text", on_selection_change=set_value, selected_key=value, children=items ) # Show current selection in a ui.text component text = ui.text("Selection: " + value) # Display picker and output in a flex column return ui.flex( pick, text, direction="column", margin=10, gap=10, ) p = picker() ``` ### Table support There is a draft PR in the plugins repo that enables the table support on the plugins side of things (note that it currently will have type errors but should run) deephaven/deephaven-plugins#382 Here's an example that demonstrates a large number of items that also tick ```python import deephaven.ui as ui from deephaven.ui import use_state from deephaven import time_table import datetime mylist = ["mars", "pluto", "saturn"] simple_ticking = time_table("PT2S", start_time=datetime.datetime.now() - datetime.timedelta(seconds=2000)).update([ 'Id=(new Integer(i * 100))', "Planet=mylist[ (int) (3 * Math.random()) % 3 ]", ]) @ui.component def picker(): value, set_value = use_state(13800) print("Test", value) # Picker for selecting values pick = ui.picker( simple_ticking, key_column="Id", label_column="Planet", label="Text", on_selection_change=set_value, selected_key=value, ) # Show current selection in a ui.text component text = ui.text("Selection: " + str(value)) # Display picker and output in a flex column return ui.flex( pick, text, direction="column", margin=10, gap=10, ) picker_table = picker() ``` resolves #1858
- Loading branch information
Showing
34 changed files
with
1,506 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.