I'm having problems getting the current/new value from a Kendo dropdownlist in a change event in kendo viewmodel.
Html code:
<div id="dropdownExample">
<select id="nameDropDown" data-bind="value: name, events: {change: nameChanged}">
<option>James</option>
<option>Bond</option>
</select>
<div id="outputExample"></div>
</div>
Javascript code:
var vModel = kendo.observable({
name: "James",
nameChanged: function(param)
{
var paramDataName = param.data.name;
var vModelGet = this.get("name");
var outPut = "param.data.name = " + paramDataName;
outPut += "<br/>vModelGet = " + vModelGet;
$("#outputExample").html(outPut);
}
});
This code works as expected. Param.data.name give me the new value, the same does viewmodel.get("name").
However if I try to turn that dropdown into a KendoDropDownList with $("#nameDropDown").kendoDropDownList({ }) param.data.name and viewModel.get("name") give me the old value.
Any ideas?
We are currently using Kendo 2012.2.507.
Regards,
Jan Erik
Html code:
<div id="dropdownExample">
<select id="nameDropDown" data-bind="value: name, events: {change: nameChanged}">
<option>James</option>
<option>Bond</option>
</select>
<div id="outputExample"></div>
</div>
Javascript code:
var vModel = kendo.observable({
name: "James",
nameChanged: function(param)
{
var paramDataName = param.data.name;
var vModelGet = this.get("name");
var outPut = "param.data.name = " + paramDataName;
outPut += "<br/>vModelGet = " + vModelGet;
$("#outputExample").html(outPut);
}
});
This code works as expected. Param.data.name give me the new value, the same does viewmodel.get("name").
However if I try to turn that dropdown into a KendoDropDownList with $("#nameDropDown").kendoDropDownList({ }) param.data.name and viewModel.get("name") give me the old value.
Any ideas?
We are currently using Kendo 2012.2.507.
Regards,
Jan Erik