diff --git a/src/css/layui.css b/src/css/layui.css index 64c206b7..f44e9f6a 100644 --- a/src/css/layui.css +++ b/src/css/layui.css @@ -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: "";} diff --git a/src/modules/table.js b/src/modules/table.js index 47c2aa9c..9ecb5314 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -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);