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

Pickers for Instants are awkward to use and produce unexpected results #547

Open
chipkent opened this issue Jun 12, 2024 · 1 comment
Open
Labels
bug Something isn't working
Milestone

Comments

@chipkent
Copy link
Member

Version: 0.34.3

The picker is returning a type that is different from the table element. As a result, there are major hoops to make it work right in subsequent queries.

from deephaven import empty_table
from deephaven import ui
from deephaven.time import to_j_instant

t = empty_table(1) \
    .update("Time = new Instant[]{'2024-11-14T03:00:00 ET', '2021-07-11T11:11:11 ET'}") \
    .ungroup() \
    .update("X=i")

@ui.component
def make_it():
    time, set_time = ui.use_state()

    print(f"DEBUG: t={time} type={type(time)}")

    # types don't match so it doesn't select the right row
    t1 = t.where("Time = time")

    # this is a PITA for something that will be common
    time_forced = to_j_instant(int(time)) if time else None
    t2 = t.where("Time = time_forced")

    return [
        ui.picker(t.select_distinct("Time"), label_column="Time", is_selected=time, on_change=set_time),
        t1,
        t2
    ]

it = make_it()
image
@chipkent chipkent added bug Something isn't working triage labels Jun 12, 2024
@mofojed
Copy link
Member

mofojed commented Jun 12, 2024

We probably have a similar issue with using on_cell_press with ui.table with timestamps @mattrunyon
Unsure how we can elegantly handle this solution, but we'll likely need some special handling somewhere for datetimes.

@vbabich vbabich added this to the Backlog milestone Jun 18, 2024
@vbabich vbabich removed the triage label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants