Jquery easyui 怎么得到datagrid 里面的值和传到后台
1个回答
2017-07-31
展开全部
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){
}
})
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){
}
})
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询