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

DateRangePicker without end date

1 Answer 456 Views
DateRangePicker
This is a migrated thread and some comments may be shown as answers.
Diego
Top achievements
Rank 1
Diego asked on 19 Feb 2019, 04:55 PM

Hi! 

I ve been checking out the new DateRangePicker control, and i had some doubts about its usage

 

1) Is there a chance to make the end date optional? the demo published always focuses on the end date input after selecting a start date, and i want it to be optional, by that i mean to be able to select a start date and end date, o only one of them and the remaining date field to remain empty. Is that possible?

 

2) I havent seen any binding method like there is for the date picker control. In the latest, there is a DatePickerFor method, to bind the control to the viewmodel field. In the daterangepicker control i expected to be the same method (configuring the start date field and the end date field)... where my assumptions wrong? If thats the case i dont see too much use to this control :/

 

thanks!

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 21 Feb 2019, 10:56 AM
Hi Diego,

The DateRangePicker was designed so it can make selecting a range easy. Thus, by default the popup will close after a start and end for the range is selected. If you would like to close the popup after one date is selected I can suggest handling the change event of the widget and calling close() in the handler. 

.Events(e=>e.Change("onChange"))

function onChange(e) {
    this.close();
}

However, selecting only the end date for a range is not available as a built-in feature. In that scenario I would suggest using two DatePicker widgets like in the Range selection example.

Regarding your second question. Currently model binding is not available for DateRangePicker. However, the developers are working on enhancing the functionality so the DateRangePicker can be bound to model fields.


Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DateRangePicker
Asked by
Diego
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or