溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Jquery easyui datagrid 刪除多行問題

發(fā)布時間:2020-07-21 04:53:05 來源:網(wǎng)絡(luò) 閱讀:486 作者:xiaoqiang_sea 欄目:web開發(fā)

前臺代碼

<script type="text/javascript">
$(function () {
$('#test').datagrid({
title: '風(fēng)格信息',
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('提示', '請選擇要修改的數(shù)據(jù)');
return;
}
}
}, '-', {
id: 'btncut',
text: '刪除',
iconCls: 'icon-cut',
handler: function () {
//獲取表格選擇行
var rows = $('#test').datagrid('getSelections');
//判斷是否選擇行
if (!rows || rows.length == 0) {
$.messager.alert('提示', '請選擇要刪除的數(shù)據(jù)!', 'info');
return;
}
 
var parm;
//循環(huán)給提交刪除參數(shù)賦值(音樂風(fēng)格編碼)
$.each(rows, function (i, n) {
if (i == 0) {
parm = "idList=" + n.GenreId;
} else {
parm += "&idList=" + n.GenreId;
}
});
$.messager.confirm('提示', '是否刪除選中數(shù)據(jù)?', function (r) {
if (!r) {
return;
}
//提交
$.post('/GenerManage/Delete/', parm,
function (msg) {
if (msg.IsSuccess) {
$.messager.alert('提示', msg.Message, 'info', function () {
//重新加載當(dāng)前頁
$('#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問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI