您的位置:首页 > 产品设计 > UI/UE

后台获取easyui datagrid其中一行数据

2018-02-20 20:04 483 查看
body代码






js代码
var t;
function deleteAdmin(){
var row = $("#tt").datagrid('getSelected');
if (null!=row){
t=row.a_id
//传递id 删除数据
$.ajax({
type: "POST",
url: "delectAdmin",
data: "id="+t,
});
//刷新jsp界面
 location.reload();
return true;
}else{
alert("请选中你所要删除的行数据");
return false;
}
}
$(function() {

$("#tt").datagrid({
pageSize : 5,//每页显示的记录条数,默认为5  
pageList : [ 5,8,10, 15, 20 ],//可以设置每页记录条数的列表
beforePageText: '第',//页数文本框前显示的汉字
afterPageText: '页 共 {pages} 页',
displayMsg: '第{from}到{to}条,共{total}条',
columns: [[
{
title: '序号', field: 'a_id',halign: 'center',align: 'center',width:100,id:'typ',
},
{
title: '用户名称', field: 'a_name',halign: 'center',align: 'center',width:100,
},
{
title: '用户密码', field: 'a_pwd',halign: 'center',align: 'center',width:100,
},

{
title: '邮箱', field: 'a_mail',halign: 'center',align: 'center',width:100,
},
{
title: '操作',field: 'action',halign: 'center',align: 'center',width: 200,
formatter: function (value,row,index) {
if (row.editing == true) {
return "<a href='#' onclick='saveRow(" + index + ");'>确定</a>  <a href='#' onclick='reDo(" + index + ");'>取消</a>";
}
else {
return "<a href='#' onclick='return deleteAdmin();'>删除</a>";
}
}
}
]],
});
});

struts代码






action 代码





其中id需要getset  这样action 才能得到ajax传过来的值
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: