Jquery easyui怎么得到datagrid里面的值和传到后台?

2024-12-26 15:42:57
推荐回答(1个)
回答1:

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 changesRows.inserted.push(insertRows[i]);
}
}

if (updateRows.length>0) {
for (var k=0;k changesRows.updated.push(updateRows[k]);
}
}

if (deleteRows.length>0) {
for (var j=0;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){

}

})

以上是针对插入删除更新 操作