- 注册时间
- 2013-7-25
- 最后登录
- 2014-4-8
- 阅读权限
- 10
- 积分
- 293
- 精华
- 0
- 帖子
- 79
|
factory 发表于 2013-9-17 15:57
e.cellHtml = "总计: " + total;
之后,再设置下 e.value = total
这样你获取出来的数据也就被改变了
http://miniui.com/demo/#src=datagrid/drawcell2.html
代码做如下更改
function onDrawCell(e) {
var record = e.record;
if (e.field == "total") {
var price = record.price;
var quantity = record.quantity;
e.cellHtml = price * quantity;
e.value= e.cellHtml;
}
}
function getdata(){
alert(mini.encode(grid.getData()))
}
结果
[{"price":"100","quantity":"20","_id":1,"_uid":1},{"price":"200","quantity":"30","_id":2,"_uid":2},{"price":"300","quantity":"40","_id":3,"_uid":3},{"price":"400","quantity":"50","_id":4,"_uid":4},{"price":"500","quantity":"60","_id":5,"_uid":5},{"price":"600","quantity":"70","_id":6,"_uid":6}]
结论 e.value 不能赋值 |
|