Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picker - use format settings from redux store #393

Closed
bmingles opened this issue Mar 28, 2024 · 0 comments · Fixed by #394
Closed

Picker - use format settings from redux store #393

bmingles opened this issue Mar 28, 2024 · 0 comments · Fixed by #394
Assignees

Comments

@bmingles
Copy link
Contributor

Once deephaven/web-client-ui/pull/1907 is merged, need to pass in Settings from redux store to jsapi Picker

@bmingles bmingles self-assigned this Mar 28, 2024
bmingles added a commit to bmingles/deephaven-plugins that referenced this issue Mar 28, 2024
bmingles added a commit to bmingles/deephaven-plugins that referenced this issue Apr 3, 2024
bmingles added a commit to bmingles/deephaven-plugins that referenced this issue Apr 3, 2024
bmingles added a commit to bmingles/deephaven-plugins that referenced this issue Apr 3, 2024
bmingles added a commit to bmingles/deephaven-plugins that referenced this issue Apr 3, 2024
bmingles added a commit to bmingles/deephaven-plugins that referenced this issue Apr 4, 2024
bmingles added a commit to bmingles/deephaven-plugins that referenced this issue Apr 4, 2024
bmingles added a commit to bmingles/deephaven-plugins that referenced this issue Apr 4, 2024
bmingles added a commit that referenced this issue Apr 10, 2024
* Update DHC packages to ^0.72.0
* Passing formatter settings from Redux store to Picker component

**Testing**
This shows pickers that use number + date formats. Changing format
settings will update selected item text + item labels real time.
```python
import deephaven.ui as ui
from deephaven.ui import use_state
from deephaven import time_table
import datetime
 
column_types = time_table("PT2S", start_time=datetime.datetime.now() - datetime.timedelta(seconds=2000)).update([
    "Int=new Integer(i)",
    "Double=new Double(i+i/10)",
])

@ui.component
def picker():
    value, set_value = use_state(1000)
    value2, set_value2 = use_state(1001)
    value3, set_value3 = use_state()

    print("Test", value)

    # Picker for selecting values
    pick = ui.picker(
        column_types,
        key_column="Int",
        label_column="Int",
        label="Int",
        on_selection_change=set_value,
        selected_key=value
    )

    pick2 = ui.picker(
        column_types,
        key_column="Double",
        label_column="Double",
        label="Double",
        on_selection_change=set_value2,
        selected_key=value2,
    )

    pick3 = ui.picker(
        column_types,
        key_column="Timestamp",
        label_column="Timestamp",
        label="Timestamp",
        on_selection_change=set_value3,
        selected_key=value3,
    )

    # Display picker and output in a flex column
    return ui.flex(
        pick,
        ui.text(value, key="text1"),
        pick2,
        ui.text(value2, key="text2"),
        pick3,
        ui.text(value3, key="text3"),
        direction="column",
        margin=10,
        gap=10,
    )

picker_column_types = picker()
```

resolves #393
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant