日期:2014-05-17 浏览次数:20739 次
{ field: 'C4', title: '下载附件', width: 200, align: 'center', formatter: function(value, rec) { return "<input type=\"button\" value=\"下载附件\" onclick=\"DownFile('" + value + "','" + rec['C2'] + "')\" />"; } } function DownFile(title,val) { $('#distributionform').form('submit', { url: '/WorkAera/PublicWork/ASHX/ProjectListInformation.ashx?DownId=' +title , onSubmit: function() { $('#HiddenPID').val(val); }, success: function(data) { $('#distributionWindow').dialog('close'); $('#HiddenUserId').val(""); $('#HiddenPID').val(""); if (data == "Exception") { $.messager.alert('运行异常', '对不起,系统运行异常,请您按要求填写信息,或者请您重启浏览器!', 'error'); } } }); }
------解决方案--------------------
var insertRows = $('#test').datagrid('getChanges','inserted');
var updateRows = $('#test').datagrid('getChanges','updated');
var deleteRows = $('#test').datagrid('getChanges','deleted');
var changesRows = {
inserted : [],
updated : [],
deleted : [],
};
if (insertRows.length>0) {
for (var i=0;i<insertRows.length;i++) {
changesRows.inserted.push(insertRows[i]);
}
}
if (updateRows.length>0) {
for (var k=0;k<updateRows.length;k++) {
changesRows.updated.push(updateRows[k]);
}
}
if (deleteRows.length>0) {
for (var j=0;j<deleteRows.length;j++) {
changesRows.deleted.push(deleteRows[j]);
}
}
$.ajax({
type: "post",
url: "../stock/stock_modify.asp",
data: "inserted="+JSON.stringify(changesRows.inserted)+"&updated="+JSON.stringify(changesRows.updated)+"&deleted="+JSON.stringify(changesRows.deleted),
datatype: "json",
success:function(data){
}
})
以上是针对插入删除更新 操作