Monday, May 9, 2016

Kendo Dropdownlist change function syntax

This delayed my coding progress for quite sometime, I was trying to bind a js function to the change event of a drop down list, the syntax I was using was like:


  $("#srch" + i).kendoDropDownList({
            optionLabel: "- Please select -",
            dataTextField: "DisplayName",
            dataValueField: "savedSearchID",
            change: "searchOnChange",
            dataSource: json
        });


I couldn't figure out why it was blowing up.  Quite simple fix, remove the quotes around the function name, so this worked (note quotes removed from searchOnChange):


  $("#srch" + i).kendoDropDownList({
            optionLabel: "- Please select -",
            dataTextField: "DisplayName",
            dataValueField: "savedSearchID",
            change: searchOnChange,
            dataSource: json
        });

No comments:

Post a Comment