- 注册时间
- 2013-8-8
- 最后登录
- 2015-7-28
- 阅读权限
- 10
- 积分
- 402
- 精华
- 0
- 帖子
- 106
|
function saveGoOn() {
var cnt_bc = grid.getData().length;
if (cnt_bc < 1) {
mini.alert("明细不能少于一条");
return;
}
grid.commitEdit(); //提交所有行
//var form = new mini.Form("form1");
form.validate(); //验证表单
if (form.isValid() == false) return; //验证失败返回
grid.validate();
if (grid.isValid() == false) {
var error = grid.getCellErrors()[0];
grid.beginEditCell(error.record, error.column);
return;
}
var rows = grid.getSelecteds();
for (var i = 0, l = rows.length; i < l; i++) {
var row = rows[i];
grid.updateRow(row, { MBFL: mini.get("MBFL").getValue() });
}
//此处即为把_id赋值给XH的地方
for (var j = 0, k = rows.length; j < k; j++) {
var row1 = rows[j];
grid.updateRow(row1, { XH: mini.get("_id") });
}
var Zdata = form.getData();
var Cdata = grid.getChanges(); //datagrid数据
var Cjson = mini.encode(Cdata);
var Zjson = mini.encode([Zdata]);
// grid.loading("保存中,请稍后......");
$.ajax({
url: "RCLRMB_data.aspx?method=InsertRCLRMB",
data: { Zdata: Zjson, Cdata: Cjson },
type: "post",
success: function(text) {
var o = mini.decode(text);
if (o.Messageid != "-1") {
alert("保存成功!");
grid.clearRows();
grid.reload();
}
else {
alert("保存失败!");
}
}
});
}
|
|