Has*_*bul 4 kendo-ui kendo-grid kendonumerictextbox
考虑我有一个kendo网格,如
http://jsbin.com/uxumab/1/
它有ItemId,Qty,Price和Total(模板)列.我想让Qty列可编辑,并希望通过更改Qty列来更改总列值.最后,我想使用迭代通过网格检索所有值的新更改.
基本上最简单的方法是通过kendo的MVVM来做到这一点.这是一个例子:
$(document).ready(function () {
var gridData = [
{ ItemId: "1001", Qty: 2, price: 200 }
, { ItemId: "1002", Qty: 1, price: 100 }
, { ItemId: "1003", Qty: 1, price: 150 }
];
$("#grid").kendoGrid({
dataSource: gridData
, selectable: "row",
dataBound:function(){
grid = this;
grid.tbody.find('tr').each(function(){
var item = grid.dataItem(this);
kendo.bind(this,item);
})
}
, columns: [
{ field: "ItemId" }
, { field: "Qty" }
, { field: "price" }
, { title: "Quantity", width: "200", template: '<input data-role="numerictextbox" data-bind="value:Qty" data-max-value="100"/>' } , {
title: "Total"
, template: "#=Qty*price#"
}
]
});
});
Run Code Online (Sandbox Code Playgroud)
和现场版.
| 归档时间: |
|
| 查看次数: |
14208 次 |
| 最近记录: |