DateRangePicker without end date

2 posts, 0 answers
  1. Diego
    Diego avatar
    7 posts
    Member since:
    Aug 2016

    Posted 19 Feb 2019 Link to this post

    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!

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2491 posts

    Posted 21 Feb 2019 Link to this post

    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.
Back to Top