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

KendoUI DatePicker Clear Button

2 Answers 2859 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sebastian
Top achievements
Rank 1
Sebastian asked on 08 Mar 2018, 09:54 AM

Hello

we use <kendo-datepicker> to select "from" and "to" dates. But these fields are not mandatory and the user should be able to clear the date fields manually. Does Kendo DatePicker component provide an easy way to clear a selected date? Something like an X icon inside the input area or a CLEAR button inside the popup, e.g. beside the TODAY link?

Best regards

Sebastian

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 09 Mar 2018, 07:51 AM
Hello Sebastian,

The DatePicker enables the users to clear the picked/typed value using the keyboard DEL or BACKSPACE keys. Right now, it doesn't provide any shortcut button that will behave as "X" clear input button.

Nevertheless, you can easily extend the current rendering and add a "X" clear button with a custom Directive. Here is a simple plunkr demo that demonstrates this approach:

https://plnkr.co/edit/WdAtBBnmGP5geOJQciRj?p=preview

Please note that you can modify the directive in any means in order to achieve your business requirements.

Regards,
Georgi Krustev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Daniel
Top achievements
Rank 1
Iron
commented on 01 Aug 2024, 03:35 PM

this does not appear to work anymore. You can't assign null to the component.value. Component does not have an element property. You can't emit null from the component.ValueChange.
0
Yanmario
Telerik team
answered on 02 Aug 2024, 07:43 AM

Hi Daniel,

From version 16.0.0 the DateInputs officially support a clear button functionality: 

https://www.telerik.com/kendo-angular-ui/components/dateinputs/api/DatePickerComponent/#toc-clearbutton

Regards,
Yanmario
Progress Telerik

Tags
General Discussions
Asked by
Sebastian
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Yanmario
Telerik team
Share this question
or