I have a Kendo ComboBox populated with a list, and when the user selects a different option in the list, I want pageModel.newServiceModel.JobSelectionChange() to fire. I've tried 3 different ways of doing this, with none of them working. I've tried to simply set change: pageModel.newServiceModel.JobSelectionChange(), change: (the entirety of what's embedded in the pageModel.newServiceModel.JobSelectionChange() function itself), and what I currently have. None of them have resulted in the function being called when I change the selection in the dropdown. Also, the commented out change: console.log() does indeed work, so it has something to do with this function itself. Any ideas on this?
pageModel.newServiceModel.JobSelectionChange = function () {
...
}
// loading combobox
pageModel.newServiceModel.selectedJobs.subscribe(function (newData) {
$("#newServiceJobs").data("kendoComboBox").dataSource.data(newData);
});
$("#newServiceJobs").kendoComboBox({
placeholder: "Select One",
filter: "contains",
suggest: true,
change: function() { pageModel.newServiceModel.JobSelectionChange(); },
//change: function() { console.log("hello") },
dataSource: pageModel.newServiceModel.selectedJobs(),
dataTextField: "name",
dataValueField: "jobid"
});
Strange, it should be working how you have it - the only thing I would point out in your other attempts, is to not execute the function when setting it.
so:
If you do that, and put a console log/debugger/alert in your JobSelectionChange function, do you still not see it execute? Cause if you can't see that function hit, at the very least, you should see an error in the console, something along the lines of that function doesn;t exist or can't call something on undefined.