C# 为剑道ui组合框触发两次更改事件

C# 为剑道ui组合框触发两次更改事件,c#,jquery,angularjs,combobox,kendo-ui,C#,Jquery,Angularjs,Combobox,Kendo Ui,我注意到我的应用程序中的所有组合框中都有一些奇怪的行为,过了一段时间,我注意到剑道UI组合框两次发出或触发更改事件,因此如果其中的代码有一个http请求,它们会发出两个http请求 我找了很多,但找不到任何帮助 我使用带有angularjs k-options(用于常规选项)和k-on-change属性的组合框作为更改事件处理程序 我尝试在没有angularjs属性的情况下实现组合框,就像正常使用剑道ui组合框一样,它给出了相同的行为 我没有使用alert调试此问题,而是使用console.lo

我注意到我的应用程序中的所有组合框中都有一些奇怪的行为,过了一段时间,我注意到剑道UI组合框两次发出或触发更改事件,因此如果其中的代码有一个http请求,它们会发出两个http请求 我找了很多,但找不到任何帮助

  • 我使用带有angularjs k-options(用于常规选项)和k-on-change属性的组合框作为更改事件处理程序
  • 我尝试在没有angularjs属性的情况下实现组合框,就像正常使用剑道ui组合框一样,它给出了相同的行为
  • 我没有使用alert调试此问题,而是使用console.log进行调试
  • 我使用fiddler监视http请求,发现任何更改都有两个请求
  • 我甚至尝试将请求更改为post,将参数更改为data,但也发现了同样的问题
  • 代码示例: html;

    “脚本标记”中的代码

    var app = angular.module('app', ['blockUI', 'kendo.directives']);
    
    app.controller("controller",
        function($scope, $http) {
    
            $scope.GetAllData = function() {
    
                $scope.comboDataSource = new kendo.data.DataSource({
    
                    data: @Html.Raw(Json.Encode(ViewBag.listFromC#)) // before loading view we're assigning the viewbag with alist of data
                });
    
                $scope.options = {
                    autoWidth: true,
                    filter: "contains",
                    ignoreCase: true,
                    placeholder: "Choose ...",
                    syncValueAndText: true,
                    dataTextField: "Name",
                    dataValueField: "Id",
                    dataSource: $scope.comboDataSource
                };
    }
    }
    
    $scope.change = function (kendoEvent) {
                   // kendoEvent.preventDefault(); // this line was added to test if it will prevent the second request or change event firing
                    console.log('change fired');
    
    
                var cbAnother = $("#cbAnother").data("kendoComboBox"); // those two lines has no effect if removed
                cbAnother.setDataSource([]);
    
                if (!kendoEvent.sender.value()) { // this if statement has no effect if removed
    
                    return;
                }
    
                $http({
                    method: "get",
                    url: "@Url.Action("Action", "MVCControler", new {area = "Area"})",
                    params: { Id: kendoEvent.sender.value() }
                }).then(function(response) {
                        var dataS = new kendo.data.DataSource({
                            data: response.data.ourData
                        });
    
                        $("#cbAnother").data("kendoComboBox").setDataSource(dataS);
                    },
                    function() {
                        ....
                    }
                );
            };
    
    代码的其余部分。。。。
    我很确定我的大括号都结束得很好

    我发现这是一个bug,所以我回滚到了以前的版本,它运行得很好