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

Does DatePicker must have a onChange handler?

3 Answers 485 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
João Paulo
Top achievements
Rank 1
João Paulo asked on 24 Apr 2019, 06:56 PM

Does DatePicker must have a onChange handler?

I am trying to use DatePicker but I can't type the day portion of the date it doesn't emit any errors or warnings here is my code below....

any ideas??

01.const SingleDate = ({ label, required, name, ...props }: ISingleDate): React.ReactElement => {
02.  return (
03.    <div className="erp-input-date">
04.      <label className="k-form-field" data-cy={name}>
05.        <span>{label}</span>
06.        {required && <span className="erp-field-required">*</span>}
07.        <DatePicker
08.          {...props}
09.          name={name}
10.          format="dd/MM/yyyy"
11.          formatPlaceholder={{ year: "ano", month: "mes", day: "dia" }}
12.        />
13.      </label>
14.    </div>
15.  );
16.};

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 25 Apr 2019, 05:15 AM
Hello, Joao Paulo,

The KendoReact DatePicker has controlled and uncontrolled modes. The onChange handled is required in controlled mode(when value is set). When defautlValue is set, the component is in uncontrolled mode and the onChange handler is not needed:

https://www.telerik.com/kendo-react-ui/components/dateinputs/datepicker/controlled-state/#toc-controlling-the-date-value

https://www.telerik.com/kendo-react-ui/components/dateinputs/datepicker/default-value/#toc-setting-the-default-value

-------------------------------

https://reactjs.org/docs/uncontrolled-components.html

https://reactjs.org/docs/forms.html#controlled-components

I hope this will help to achieve the desired result.

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
João Paulo
Top achievements
Rank 1
answered on 26 Apr 2019, 12:11 PM

Hello Stefan thanks for the information.

I think the problem may be the compiler that I am using(Rollup) because when i use the component in a create-react-app it works just fine!!

have you ever had any issues about using KendoReact with Rollup compiler?

0
Accepted
Stefan
Telerik team
answered on 29 Apr 2019, 06:32 AM
Hello, Joao Paulo,

Currently, we do not have report for such an issue with Rollup.

Still, it could be related to some of the configurations.

I will be happy to assist in this case, if there is an runnable example where we can test locally to determine what could be the reason for this issue.

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
João Paulo
Top achievements
Rank 1
Answers by
Stefan
Telerik team
João Paulo
Top achievements
Rank 1
Share this question
or