2014-12-03 58 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/