【发布时间】:2014-12-24 23:46:46
【问题描述】:
我目前有一个包含三列的网格:数量、价格和总价格。我所做的只是使 qty 列可编辑。我想要的是当 qty 单元格更改为 totalPrice 列时自动更新(执行 qty * price)。我尝试将模板添加到 totalPrice 列,如下所示:
template: "#= qty * price #"
但这不起作用。
有人可以帮忙吗?
grid = $("#grid").kendoGrid({
dataSource: dsDataSource,
height: 500,
editable: "incell",
groupable: false,
sortable: false,
selectable: true,
pageable: false,
scrollable: true,
navigatable: false,
change: function(e){
},
columns:
[
{field: "qty", editable: true, title: "Qty", width: "20px", headerAttributes: {style:"text-align:center;"}, attributes: {style:"text-align:right;" } },
{field: "price", editable: false, title: "Price", width: "20px", headerAttributes: {style:"text-align:center;"}, attributes: {style:"text-align:right;" } },
{field: "totalPrice", editable: false, title: "Total", width: "20px", headerAttributes: {style:"text-align:center;"}, attributes: {style:"text-align:right;" }, template: "#= qty * price#" }
]
}).data("kendoGrid");
【问题讨论】:
-
你能提供一些代码来帮助你吗?
标签: kendo-ui kendo-grid