SteveInTN
SteveInTN

Reputation: 99

Kendo Change Event Not Firing

I have a Kendo window (modal) that I am populating with various elements in order to gather different properties of a "widget" within my app. I have drop down lists, numeric text boxes, mutli-selects, etc. I have wire up the change event for ALL of them, such as with the drop down below:

@(Html.Kendo().DropDownList()
    .Name("property-edit-" + @WidgetProperty.widget_property)
    .HtmlAttributes(new { @class = "widget-property-value-edit andon-type-" + WidgetProperty.widget_property_type.ToLower(), style = "width:300px; height: 30px" })
    .DataTextField("tag_name")
    .DataValueField("tag_name")
    .Value(WidgetProperty.widget_property_value)
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("AndonTagList", "List", new { DataType = Model.widget_data_type });
        })
        .ServerFiltering(true);
    })
    .Enable(true)
    .Events(e => { e.Change("propertyChanged('property-edit-" + @WidgetProperty.widget_property + "')"); })

)

The Change Event for all of the Kendo controls only fire when the view is first rendered and their values are filled through the .Value() configuration property. None of them fire again whether I select a new value, edit a text box, or use the spinner.

The script rendered by the drop down looks good to me?

kendo.syncReady(function(){jQuery("#property-edit-Tag-Name").kendoDropDownList({"change":propertyChanged('property-edit-Tag-Name'),"dataSource":{"transport":{"read":{"url":"/List/AndonTagList?DataType=Text","data":function() { return kendo.ui.DropDownList.requestData(jQuery("#property-edit-Tag-Name")); }},"prefix":""},"serverFiltering":true,"filter":[],"schema":{"errors":"Errors"}},"dataTextField":"tag_name","dataValueField":"tag_name"});});

I have non-kendo inputs on the same view with onchange events that work as expected.

There are no errors in the console.

Here is the function being called, nothing special:

function propertyChanged(PropertyElement)
    {
        console.log("Element: " + PropertyElement);
    }

Any ideas?

Upvotes: 1

Views: 2299

Answers (1)

SteveInTN
SteveInTN

Reputation: 99

I was trying to pass a parameter to the function handling the change event. Can't do that.

All I wanted was the name of the element calling the function so I can get that.

Upvotes: 0

Related Questions