Skip to content

Update DatePickerInput value after the popover is closed #556

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

Closed
Winand opened this issue Apr 4, 2025 · 3 comments
Closed

Update DatePickerInput value after the popover is closed #556

Winand opened this issue Apr 4, 2025 · 3 comments

Comments

@Winand
Copy link

Winand commented Apr 4, 2025

I use dash 3.0.2, dash-mantine-components 1.1.1.

Is it somehow possible to update DatePickerInput value after its popover is closed? I want to trigger an update when a user selects a date range and clicks outside of the date picker popover.

    dmc.DatePickerInput(w=250, type="range", numberOfColumns=2, maxDate=rng_dates[1],
                        columnsToScroll=1, allowSingleDateInRange=True,
                        closeOnChange=False, minDate=rng_dates[0],  # debounce=True,
                        value=def_dates, id="datepicker",
                        ),

I've tried debounce but I don't like that it triggers value update only when the date picker loses focus. #496
Maybe it's possible to use popover's opened property? #353

@AnnMarieW
Copy link
Collaborator

Typically, when you click outside the input field loses focus, so debounce=True should work. If not have you considered adding an enter button?

@Winand
Copy link
Author

Winand commented Apr 4, 2025

when you click outside the input field loses focus, so debounce=True should work

On the first click popover closes but the input field remains focused, on the second click it loses focus and "value" event fires.

If not have you considered adding an enter button?

No, I don't want an additional button click. I can simply update data every time I change start\end date, because it's a local application with a small database. But it would be good if I could reduce the number of requests by half.

But in theory is it possible to provide opened property in future releases? Or it depends on implementation in Mantine project?

@AnnMarieW
Copy link
Collaborator

We are not planning on adding an opened property. This functionality could be handled when we add the ability to have functions as props. Then you would be able to pass a function to the onOpen and onClose props using the PopoverProps.

I'll add a note to #356 and close this issue as a duplicate.

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

No branches or pull requests

2 participants