This is a migrated thread and some comments may be shown as answers.

DateTimePicker

5 Answers 698 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vasil
Top achievements
Rank 1
Vasil asked on 07 Jul 2020, 07:59 AM

Hello, 

I'm trying to use DateTimePicker like this: 

<DateTimePicker
show={show}
onChange={this.onDatepickerChange}
// cancelButton={false}
popupSettings={{
appendTo: this.renderRef,
animate: false,
}}
/>
<Button  onClick={this.toggleCalendar} />
<div id="render" ref={(render) => { this.renderRef = render; }} />

1. I don't have control on "Cancel" button. When I set show prop and try to toggle the calendar with custom button, the "Cancel" button doesn't work. I can only hide it.

2. Then I tried to set DateTimePicker popup to Not render in the "body", but it doesn't work. Every popupSettings is ignored. I tried this in kendo react Popup component and the prop "appendTo" worked as expected.

Thanks in advance for the help !


 

 

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 07 Jul 2020, 10:21 AM

Hello, Vasil,

Regarding both questions/issues:

1) The event that is fired when the cancel button is clicked is onBlur. Still, as this event is fired in many other cases, we can check inside the event if it was triggered by the cancel button and close the DateTimePicker:

https://stackblitz.com/edit/react-vtzmkt?file=app/main.jsx

https://www.telerik.com/kendo-react-ui/components/dateinputs/api/DateTimePickerProps/#toc-onblur

2) This is because the DateTimePicker has no popupSettings prop:

https://www.telerik.com/kendo-react-ui/components/dateinputs/api/DateTimePickerProps/

We are planning a large update of the DateTimePicker this quarter and this could be one of the new properties.

Regards,
Stefan
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Vasil
Top achievements
Rank 1
answered on 07 Jul 2020, 11:38 AM

Thanks :). The first one worked with one additional check.

One last question.
Is it possible to open DateTimePicker with custom button on the tab with "Time". 

Thanks again, for the quick response !

0
Stefan
Telerik team
answered on 08 Jul 2020, 05:57 AM

Hello, Vasil,

Currently, the DateTimePicker can be opended only on the date part as this is required for selecting the complete date.

Still, if there is a special use case, a ref of the component can be used with private property, but it is not recommended and has to be used with caution:

https://stackblitz.com/edit/react-tlbdh5?file=app/main.jsx

Also, we can suggest making an official feature request that will provide a property to set it out of the box. This is how we determine which will be the next components and features to be implemented base on the community interest:

https://feedback.telerik.com/kendo-react-ui

Regards,
Stefan
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Vasil
Top achievements
Rank 1
answered on 16 Jul 2020, 11:47 AM

Hello, Stefan

First thanks for the support. I made the DP to open with custom buttons , managed to hide input format by using another input to renter what i want , and hide the DP input. 
But now i faced the problem when i click outside of the DateTimePicker it doesn't close.
On the demo in the doc in hides when you click out of the input or the  datepicker popup
Is there some prop for that or ?

BR,
Vasil

0
Kiril
Telerik team
answered on 20 Jul 2020, 09:17 AM

Hi Vasil,

When the `show` property is set to the `DateTimePicker`, the developer is in full control of the internal `show` state and we do not override the provided `show` value.

I have prepared the following stackblitz example which demonstrates how to close the Popup on `blur` when the `show` value is in controlled state:
https://stackblitz.com/edit/react-kypmsd

Please let me know if you need further assistance.

Regards,
Kiril
Progress Telerik

Tags
General Discussions
Asked by
Vasil
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Vasil
Top achievements
Rank 1
Kiril
Telerik team
Share this question
or