Kendo DatePicker change event doesn't fire on change

2 posts, 0 answers
  1. Joey
    Joey avatar
    3 posts
    Member since:
    Sep 2016

    Posted 03 Jan Link to this post

    I have replicated this in the sample project attached.

    Simply put, change events on the Kendo DatePicker control (created by the MVC wrapper), fire immediately upon loading the page, but do not fire when the date value of the control is changed.

  2. Patrick
    Admin
    Patrick avatar
    203 posts

    Posted 04 Jan Link to this post

    Hi Joey,

    First, thank you for the sample project replicating the issue.  That helps!

    After reviewing your code, I believe the issue is the way you set your event handlers.  There are 2 ways you can set it:

    1.  By the Handler Name:

    For the change event to fire using a handler name, set the change event like the following:
    @(Html.Kendo().DatePicker()
        ...
        .Events(e =>
        {
            e.Change("change");
        })
    )
     
    <script>
        function change() {
            console.log("Changed!");
        }
    </script>

    2. By Template Delegate:

    The following shows how to subscribe to the change event by template delegate:
    @(Html.Kendo().DatePicker()
        ...
        .Events(e =>
        {
             e.Change(
                @<text>
                function(e) {
                    console.log("Changed!");
                }
                </text>
        );
    })
    )

    I've attached an updated project using both styles.  The Change event is using the Handler Name, and the Open event uses the Template Delegate.

    Hope this helps!

    Regards,
    Patrick
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top