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 0a925ee08..5430db131 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 @@ -595,7 +595,15 @@ var table = { hideAllColumns: function(tableId) { var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId; $("#" + currentId).bootstrapTable('hideAllColumns'); - } + }, + // 选中/取消选中表格某一行 + toggleCheck: function (index, checked, tableId) { + let currentId = $.common.isEmpty(tableId) ? table.options.id : tableId; + $("#" + currentId).bootstrapTable( + checked ? 'check' : 'uncheck', + index + ); + }, }, // 表格树封装处理 treeTable: { diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/other.html b/ruoyi-admin/src/main/resources/templates/demo/table/other.html index b0a6e9cce..b21339c45 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/other.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/other.html @@ -24,6 +24,9 @@ 获取选中首列值 + + 选中第一行 +
@@ -47,23 +50,23 @@ checkbox: true }, { - field : 'userId', + field : 'userId', title : '用户ID' }, { - field : 'userCode', + field : 'userCode', title : '用户编号' }, { - field : 'userName', + field : 'userName', title : '用户姓名' }, { - field : 'userPhone', + field : 'userPhone', title : '用户手机' }, { - field : 'userEmail', + field : 'userEmail', title : '用户邮箱' }, { @@ -91,12 +94,12 @@ }; $.table.init(options); }); - + function selectColumns() { var column = $.table.selectColumns('userName'); alert(column); } - + function selectFirstColumns() { var column = $.table.selectFirstColumns(); alert(column);