DropDownList and ViewModel change event

5 posts, 0 answers
  1. Jan Erik
    Jan Erik avatar
    24 posts
    Member since:
    Mar 2011

    Posted 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
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 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!
  3. Kendo UI is VS 2017 Ready
  4. Ladislav
    Ladislav avatar
    32 posts
    Member since:
    Jan 2009

    Posted 14 Feb 2014 in reply to Alexander Valchev Link to this post

    Hi,

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

    Regards,
    Ladislav
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 17 Feb 2014 Link to this post

    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!
  6. Ladislav
    Ladislav avatar
    32 posts
    Member since:
    Jan 2009

    Posted 17 Feb 2014 in reply to Alexander Valchev Link to this post

    Hi, Alexander,

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

    Regards,
    Ladislav
Back to Top
Kendo UI is VS 2017 Ready