From cefb14e521d5d29df86eef1d2db4912213377e6d Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 12 Nov 2020 10:30:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A1=A8=E6=A0=BC=E8=A1=8C?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E4=BA=8B=E4=BB=B6=EF=BC=88onCheck=E3=80=81on?= =?UTF-8?q?Uncheck=E3=80=81onCheckAll=E3=80=81onUncheckAll=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ruoyi/js/ry-ui.js | 4 +++ .../resources/templates/demo/table/event.html | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index d7fd933b..a35662d9 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -116,6 +116,10 @@ var table = { mobileResponsive: options.mobileResponsive, // 是否支持移动端适配 cardView: options.cardView, // 是否启用显示卡片视图 detailView: options.detailView, // 是否启用显示细节视图 + onCheck: options.onCheck, // 当选择此行时触发 + onUncheck: options.onUncheck, // 当取消此行时触发 + onCheckAll: options.onCheckAll, // 当全选行时触发 + onUncheckAll: options.onUncheckAll, // 当取消全选行时触发 onClickRow: options.onClickRow, // 点击某行触发的事件 onDblClickRow: options.onDblClickRow, // 双击某行触发的事件 onClickCell: options.onClickCell, // 单击某格触发的事件 diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/event.html b/ruoyi-admin/src/main/resources/templates/demo/table/event.html index e3c8a6dc..372b4c91 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/event.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/event.html @@ -24,6 +24,10 @@ showRefresh: false, showToggle: false, showColumns: false, + onCheck: onCheck, + onUncheck: onUncheck, + onCheckAll: onCheckAll, + onUncheckAll: onUncheckAll, onClickRow: onClickRow, onDblClickRow: onDblClickRow, onClickCell: onClickCell, @@ -95,6 +99,28 @@ alert("双击格name:" + field + " value:" + value); } + function onCheck(row, $element){ + alert("选中行userId:" + row.userId + " userName:" + row.userName); + } + + function onUncheck(row, $element){ + alert("取消行userId:" + row.userId + " userName:" + row.userName); + } + + function onCheckAll(rowsAfter, rowsBefore){ + var rows = $.map(rowsAfter, function(row) { + return $.common.getItemField(row, "userId"); + }); + alert("全选行:" + rows); + } + + function onUncheckAll(rowsAfter, rowsBefore){ + var rows = $.map(rowsBefore, function(row) { + return $.common.getItemField(row, "userId"); + }); + alert("取消行:" + rows); + } + function responseHandler(res){ alert("请求获取数据后处理回调函数"); }