kendo ui 实现MVVM

MVVM                    model----view model----model 实现页面和model之间的动态绑定

 

grid 支持 events  source  visible绑定

 

第一步建立一个observable对象   对象为参数

       var viewModel = kendo.observable()

第二步实现视图与 viewModel绑定

 kendo.bind($("#example"), viewModel);  //jQuery对象

注意对某一属性设置值时使用

this.set("isDescriptionShown", true);
 showDescription: function(e) {
       e.stopPropagation(); 
    e.preventDefault();
  this.set("isDescriptionShown", true); //给属性赋值
}

 
 



    
    
    
    

    
    
    



Add or update a record

data-editable="true" data-toolbar="['create', 'save']" data-columns="[ { 'field': 'ProductName', 'width': 270 }, { 'field': 'UnitPrice' }, ]" data-bind="source: products, //绑定的属性 visible: isVisible, //显示隐藏 events: { save: onSave }" style="height: 200px">

Console

Configuration

//绑定的属性

Information

Kendo UI Grid supports the events, source and visible bindings.

 

你可能感兴趣的:(kendo ui 实现MVVM)