新增 table `colTool` 事件,点击表头自定义元素触发,提升 table 的可玩性

pull/1287/head
贤心 2023-06-19 17:03:36 +08:00
parent 9d678a6be6
commit 3c8d20d23d
2 changed files with 17 additions and 0 deletions

View File

@ -1011,7 +1011,9 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-table-view .layui-table[lay-skin="row"]{border-width: 0; border-bottom-width: 1px;}
.layui-table-view .layui-table th,
.layui-table-view .layui-table td{padding: 0; border-top: none; border-left: none;}
.layui-table-view .layui-table th [lay-event],
.layui-table-view .layui-table th.layui-unselect .layui-table-cell span{cursor: pointer;}
.layui-table-view .layui-table th span,
.layui-table-view .layui-table td{cursor: default;}
.layui-table-view .layui-table td[data-edit]{cursor: text;}
.layui-table-view .layui-table td[data-edit]:hover:after{position: absolute; left: 0; top: 0; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid #16B777; pointer-events: none; content: "";}

View File

@ -1948,6 +1948,21 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
},{}));
});
// 表头自定义元素事件
that.layHeader.on('click', '*[lay-event]', function(e){
var othis = $(this);
var events = othis.attr('lay-event');
var th = othis.closest('th');
var key = th.data('key');
var col = that.col(key);
layui.event.call(this, MOD_NAME, 'colTool('+ filter +')', $.extend({
event: events,
config: options,
col: col
},{}));
});
// 分页栏操作事件
that.layPagebar.on('click', '*[lay-event]', function(e){
var othis = $(this);