This is a migrated thread and some comments may be shown as answers.

DropDownList and ViewModel change event

4 Answers 290 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jan Erik
Top achievements
Rank 2
Jan Erik asked on 18 May 2012, 12:01 PM
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

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 23 May 2012, 08:44 AM
Hi Jan,

I have already replied to your support query on the same subject. For convenience I am pasting my reply here too:

I tried to reproduce this behaviour in IE9 with v. 2012.1.515 (Q1 Service Pack), but to no avail. Could you please check the test page that I used and let me know if I missed something?

Thank you in advance for your cooperation.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ladislav
Top achievements
Rank 1
answered on 14 Feb 2014, 12:45 PM
Hi,

I want to bind to MVVM change event.
http://jsfiddle.net/BHeYe/
It doesn't work. What I am doing wrong?

Regards,
Ladislav
0
Alexander Valchev
Telerik team
answered on 17 Feb 2014, 10:19 AM
Hi Ladislav,

You example fails with JavaScript error caused by a typo mistake in the code. Please check the attached screen shot.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ladislav
Top achievements
Rank 1
answered on 17 Feb 2014, 10:36 AM
Hi, Alexander,

I don't see any screenshot. You right with typo. After changing to alert(e) it works.

Regards,
Ladislav
Tags
DropDownList
Asked by
Jan Erik
Top achievements
Rank 2
Answers by
Alexander Valchev
Telerik team
Ladislav
Top achievements
Rank 1
Share this question
or