easyUI 获取复选框,操作table行


//修改查询
var string = "";
function edit(){
var row = $('#tt').datagrid('getSelections');
var i = 0;
// var tag = 0;
if(row.length != 1){
alert("请选择一条数据!");
return null;
}else{
for(i;i<row.length;i++){
string = row[i].id;

}
}
$.post('userAction_selectByid.do?id='+string,function(data){
var obj=eval("("+data+")");
$.each(obj,function(index,data){
if(data.userName != undefined){
$('#userName').attr('value',data.userName);
}
if(data.userSex != undefined){
$('#userSex').attr('value',data.userSex);
}
if(data.department != undefined){
$('#department').attr('value',data.department);
}
if(data.userFolk != undefined){
$('#userFolk').attr('value',data.userFolk);
}
if(data.userCode != undefined){
$('#userCode').attr('value',data.userCode);
}
if(data.userFax != undefined){
$('#userFax').attr('value',data.userFax);
}
if(data.userMobile != undefined){
$('#userMobile').attr('value',data.userMobile);
}
if(data.userXiao != undefined){
$('#userXiao').attr('value',data.userXiao);
}
if(data.userOfficephone != undefined){
$('#userOfficephone').attr('value',data.userOfficephone);
}
if(data.userHomephone != undefined){
$('#userHomephone').attr('value',data.userHomephone);
}
if(data.userBirthdate != undefined){
$('#userBirthdate').attr('value',data.userBirthdate);
}
if(data.userRoom != undefined){
$('#userRoom').attr('value',data.userRoom);
}
if(data.userRemark != undefined){
$('#userRemark').attr('value',data.userRemark);
}
if(data.userOrder != undefined){
$('#userOrder').attr('value',data.userOrder);
}
if(data.userPhoto != undefined){
$('#userPhoto').attr('value',data.userPhoto);
}
if(data.userIsstop != undefined){
$('#userIsstop').attr('value',data.userIsstop);
}
if(data.userIsdeleted != undefined){
$('#userIsdeleted').attr('value',data.userIsdeleted);
}


});
});
open1();
// $('#editID').attr('href','userAction_selectByid.do?id='+string);
}

//提交按钮
function submit(){
if(string>0){
$('#user').attr('action','userAction_etidUser.do').submit();
}else{
$('#user').attr('action','userAction_addUser.do').submit();
}
}
//清空按钮
function clear1(){
$('input').attr('value','');
}
//打开窗口
function open1(){
$('input').attr('value','');
$('#win').panel('open');
}
//关闭窗口
$(function (){
$('#win').panel('close');
});
//无刷新移除
function del(){
var rows = $('#tt').datagrid("getSelections");
var copyRows = [];
for ( var j= 0; j < rows.length; j++) {
copyRows.push(rows[j]);
}
for(var i =0;i<copyRows.length;i++){
var index = $('#tt').datagrid('getRowIndex',copyRows[i]);
$('#tt').datagrid('deleteRow',index);
}
}
//获取easyui-datagrid中的id进行批量删除
function clickbox(){
var row = $('#tt').datagrid('getSelections');
var i = 0;
var string = "";
for(i;i<row.length;i++){
string += row[i].id;
if(i < row.length-1){
string += ',';
}else{
break;
}
}
$.post('userAction_deleteUser.do?id='+string);
del();
}
展开阅读全文

没有更多推荐了,返回首页