淘汰赛 kendo 事件触发两次

knockout kendo events fires twice

嗨,knockout-kendo 框架有问题。
每个事件都会触发两次。

有人能告诉我我的代码有什么问题吗?

我创建了一个小 fiddle

var StoreViewModel = function () {
    var self = this;
    this.stores = ko.observableArray(stores);
    this.selectedStore = ko.observable(stores[0].Id);

    // this event fires twice, dont know why!
    this.dataBoundEvent = function () {
        alert('databound event ...');
        //doSomething();
    };
    this.changeEvent = function () {
        alert('change event ...');
        //doSomething();
    };
};

谢谢!

我相信正在调用 dataBoundEvent

  1. 绑定支持数据(商店)
  2. 绑定所选值(selectedStore)

绑定事件在初始化网格和设置数据时调用。

要停止此操作,只需使用 dataSource 而不是 data

<div id="wrapper">
    <select data-bind="kendoDropDownList: {
        dataSource: stores,
        dataTextField: 'Address',
        dataValueField: 'Id',
        dataBound: dataBoundEvent,
        change: changeEvent
    }"></select>
</div>

dataSource是kendo的正常方式和支持的方式。