温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Jquery easyui datagrid 删除多行问题

发布时间:2020-07-21 04:53:05 来源:网络 阅读:480 作者:xiaoqiang_sea 栏目:web开发

前台代码

<script type="text/javascript">
$(function () {
$('#test').datagrid({
title: '风格信息',
iconCls: 'icon-save',
fit: true,
nowrap: false,
striped: true,
//collapsible: true,
url: '/GenerManage/LoadAllByPage/',
sortName: 'GenreId',
remoteSort: false,
idField: 'GenreId',
frozenColumns: [[
     { field: 'ck', checkbox: true }
                ]],
columns: [[
             { field: 'GenreId', title: '编码', width: '80', align: 'center' },
                    { field: 'Name', title: '名称', width: '200', align: 'left' },
{ field: 'Desctiption', title: '描述', width: '350', align: 'left' }
                ]],
pagination: true,
rownumbers: true,
toolbar: [{
id: 'btnadd',
text: '添加',
iconCls: 'icon-add',
handler: function () {
this.href = '/GenerManage/View/';
}
}, {
id: 'btnupdate',
text: '修改',
iconCls: 'icon-save',
handler: function () {
var rows = $('#test').datagrid('getSelected');
if (rows) {
this.href = "/GenerManage/View/" + rows.GenreId;
}
else {
$.messager.alert('提示', '请选择要修改的数据');
return;
}
}
}, '-', {
id: 'btncut',
text: '删除',
iconCls: 'icon-cut',
handler: function () {
//获取表格选择行
var rows = $('#test').datagrid('getSelections');
//判断是否选择行
if (!rows || rows.length == 0) {
$.messager.alert('提示', '请选择要删除的数据!', 'info');
return;
}
 
var parm;
//循环给提交删除参数赋值(音乐风格编码)
$.each(rows, function (i, n) {
if (i == 0) {
parm = "idList=" + n.GenreId;
} else {
parm += "&idList=" + n.GenreId;
}
});
$.messager.confirm('提示', '是否删除选中数据?', function (r) {
if (!r) {
return;
}
//提交
$.post('/GenerManage/Delete/', parm,
function (msg) {
if (msg.IsSuccess) {
$.messager.alert('提示', msg.Message, 'info', function () {
//重新加载当前页
$('#test').datagrid('reload');
});
} else {
$.messager.alert('提示', msg.Message, 'info')
}
});
});
}
}]
});
var p = $('#test').datagrid('getPager');
if (p) {
$(p).pagination({
onBeforeRefresh: function () {
alert('before refresh');
}
});
}
});
</script>

Jquery easyui datagrid 删除多行问题

Jquery easyui datagrid 删除多行问题

删除成功

Jquery easyui datagrid 删除多行问题






向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI