Premium forums

DropDownList and ViewModel change event

  • Jan Erik
    Jan Erik avatar

    18 May 2012 (Link to this post)

    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
  • Alexander Valchev
    Alexander Valchev avatar

    23 May 2012 (Link to this post)

    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!

Read FAQ or see Kendo UI in action!

Launch Demos