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
Opening DatePicker manually #685
Comments
This is pretty simple:
And then somewhere |
@alex-shamshurin It is but |
No matter, it works! This is exaxtly is used inside. |
@alex-shamshurin It's generally considered bad practice to use the |
That |
@alex-shamshurin oops I see that now. Sorry. I wonder why |
I think so. |
Improvements to the docs are welcome! Thanks! |
So |
@alex-shamshurin in my case i don't have the possibility to use it as a public method, since i can't use the "ref" property of the component to assign it to a variable and the use the setOpen. Can you add it as a property or is there any other way to express directly in the render of an outer component that the DatePicker should start opened by default? |
I really do not understand why you cannot get a reference to a component and use its methods and state. if you want it always be opened you can use |
@alex-shamshurin it's a little bit complicated to explain but basically, i'm using riek library for inline editing (values in a visual table). I'm extending that library to support inline datepicker editing. My extension class is:
This works by calling renderEditingComponent() when clicking a date value on a table column, which makes an input appears on top of it. That would be the <DatePicker ...>. Riek library needs the ref value of the input component be set as "input" so i can't really change it, otherwise it won't work or at least i will have to override bunch of methods. |
Why you cannot wrap this |
@tommyalvarez And besides, you need a reference only for |
This really needs to be documented, I shouldn't have to go to the third page of issues in order to find this... That aside, this is awesome! |
@serkolch, PRs for improvements to the docs are welcome |
the workaround doesn't work for me with v0.53.0.
and
Any ideas are appreciated... EDIT: |
I'm a react/redux newb - so didn't immediately understand how the Here's how I got the React parts to work for anyone else with same issue: Create a ref to the calendar in your components constructor: this.calendarRef = React.createRef(); Attach the ref to your calendar:
Then you can use the ref to trigger the
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
@cherner How did you get typescript to ignore it? I keep getting the error that setOpen is not an option. Thanks. |
@amemmes not recommended, but just place |
Understood but it was the only way to get it to actually build and execute the setOpen function. Thanks for that. |
There are no |
Thank you. How can this work with function components? |
@j-sup I've just come across this, I've been able to get it working with a functional component as follows: Create a ref to the calendar in the top level of the component, with the Example:
It would be good to have an open property to allow users to manage the popper display state outside of the component, rather than passing in a ref to the component though. |
For me, to close the calendar, |
How to open it manually? Is there any API exposed or I have to trigger click event on input?
The text was updated successfully, but these errors were encountered: