$('#tt').edatagrid({
url: '../getStudents',
destroyUrl:'../deleteStudent',//删除时必须给删除请求地址,才会执行删除
idField:'stuId',//标记数据表的主键
columns:[[
{field:'stuId',title:'学生编号'}
//你的列
]],
toolbar: [{
iconCls: 'icon-add',
text:'添加学生',
handler: function(){
}
},'-',{
iconCls: 'icon-remove',
text:'删除学生',
handler: function(){
$('#tt').edatagrid('destroyRow');//删除数据
}
}],
onDestroy:function (rowindex,row){//删除回调 函数
console.log(rowindex);//第一个参数是删除的第几行
console.log(row);//删除的行数据,包含了删除时后台发送成功或失败消息
//
if(row.success){
$.messager.alert('系统提示',row.msg);
}else {
$.messager.alert('系统提示',row.msg);
}
}
红框就是后台返回的数据