2014-12-03 57 views
2

所以,我想用我的複選框iCheck,但那需要自定義綁定。劍道MVVM,淘汰賽,或任何其他js庫。Kendo MVVM自定義綁定點擊複選框

我幾乎有我的自定義綁定完美,但它不觸發點擊複選框。如果我將輸入從複選框更改爲文本輸入,則單擊自定義綁定效果很好。

kendo.data.binders.myICheck = kendo.data.Binder.extend({ 
     init: function (element, bindings, options) { 
      //call the base constructor 
      kendo.data.Binder.fn.init.call(this, element, bindings, options); 
      var that = this; 
      //listen for the change event of the element 
      $(that.element).on("click", function() { 
       that.click(); //call the change function 
      }); 
     }, 
     click: function() { 
      this.bindings["myICheck"].set(false); 
     }, 
     refresh: function() { 
      var value = this.bindings["myICheck"].get(); 
      if (value) { 
       $(this.element).iCheck('check'); 
      } else { 
       $(this.element).iCheck('uncheck'); 
      } 
     } 
    }); 

HTML是

輸入不確定= 「假」 數據綁定= 「myICheck:rememberUserInfo」 級= 「檢查」>

回答

0

啊,搞明白了,I單擊都有它自己的事件: 我需要使用ifChagned或ifClicked

$(that.element).on("ifClicked", function() { 

http://fronteed.com/iCheck/