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

Date range picker change event firing 3 times

1 Answer 2289 Views
DateRangePicker
This is a migrated thread and some comments may be shown as answers.
Ramesh
Top achievements
Rank 1
Veteran
Iron
Ramesh asked on 24 Feb 2021, 11:35 AM

     Dear Support team,

i'm using the daterange picker of the Kendo UI. and I want to call a function when the from date and to date both selected (up on closing may be)

I tried using the close event but on the close event i do not get the end date (End date is null on the closing event)

your help is much appreciated

 

Thanks

Ramesh R 

1 Answer, 1 is accepted

Sort by
0
Mihaela
Telerik team
answered on 26 Feb 2021, 05:05 PM

Hello Ramesh,

Thank you for the attached screenshots.

I would recommend calling the function in the change event of the Kendo UI DateRangePicker since it fires after the close event when any of the dates is selected/changed. To prevent the calling of the function, each time the event is fired, you could verify if both start and end dates are selected, as follows:

$(document).ready(function() {
  function internalFunction(startDate, endDate) {
    ...
  } 

  function onChange() {
    var range = this.range();
    var startDate = range.start;
    var endDate = range.end;
    if(startDate && endDate ) {
      internalFunction(startDate, endDate);
    }
  }

   $("#daterangepicker").kendoDateRangePicker({
      change: onChange
    });
});
Let me know if you have any other queries. I would be happy to assist you.

 

Regards, Mihaela Lukanova Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
DateRangePicker
Asked by
Ramesh
Top achievements
Rank 1
Veteran
Iron
Answers by
Mihaela
Telerik team
Share this question
or