Approved
Last Updated: 10 Jul 2019 14:21 by Tharsis-it

Bug report

The change event is being triggered when having an initially selected item in the DropDownList and then open the DropDownList and click on the default selected item. This bug is represented only in MVVM.

Reproduction of the problem

  1. Open this Dojo and run it. The three cascading DropDownLists will have default selected items
  2. Click on the first DropDownList and select the already selected "Confections" option
  3. The other two DropDownLists will be reset because of the change event thrown in the first DropDownList

Current behavior

The change event of a DropDownList with initial data selected is being triggered when clicking on the already selected value.

Expected/desired behavior

Selecting the already selected item of a DropDownList shouldn't trigger its change event because there is no actual change in the component's value. Please check this Dojo for the expected behavior.

Environment

  • Kendo UI version: 2019.2.619
  • jQuery version: x.y
  • Browser: [all]
Approved
Last Updated: 25 Jan 2019 12:56 by ADMIN

Hello,

Drop down widget is defaulted to first option even though ng-model is undefined, in case where we bind same value to k-data-value-field and k-data-text-field.

Please have a look on the below sample code where you can find issue. My expectation is drop down should not default when model value is not assigned. 

 

Code:

                                                          

<!DOCTYPE html>
<html>
<head>
    <base href="https://demos.telerik.com/kendo-ui/dropdownlist/angular">
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.115/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.115/styles/kendo.material.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.115/styles/kendo.material.mobile.min.css" />

    <script src="https://kendo.cdn.telerik.com/2019.1.115/js/jquery.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2019.1.115/js/angular.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2019.1.115/js/kendo.all.min.js"></script>


</head>
<body>
<div id="example" ng-app="KendoDemos">
    <div class="demo-section k-content" ng-controller="MyCtrl">
    <input kendo-drop-down-list
            k-data-text-field="'name'"
            ng-model="data"
            k-data-value-field="'name'"
            k-data-source="productsDataSource"
            style="width: 100%"></input>


</div>
</div>

<script>
  angular.module("KendoDemos", [ "kendo.directives" ])
      .controller("MyCtrl", function($scope){
   // $scope.data=0;
    $scope.productsDataSource = new kendo.data.DataSource({
                        data: [{
            'name':'Active','id':0

          },{'name':'Cancel','id':1}]
                    }
                );





      });
</script>


</body>
</html>