Browse Source

Merge branch '2.x' of github.com:layui/layui into 2.x

pull/1194/head
贤心 2 years ago
parent
commit
38a579fa38
  1. 4
      README.md
  2. 8
      src/modules/table.js

4
README.md

@ -16,10 +16,10 @@
<img src="https://img.shields.io/github/license/layui/layui" alt="License">
</a>
<a href="https://github.com/layui/layui/blob/master/dist/css/layui.css">
<img src="https://img.badgesize.io/layui/layui/master/dist/css/layui.css?compression=brotli&label=CSS Brotli size" alt="CSS Brotli size">
<img src="https://img.badgesize.io/layui/layui/master/dist/css/layui.css?compression=brotli&label=CSS%20Brotli%20size" alt="CSS Brotli size">
</a>
<a href="https://github.com/layui/layui/blob/master/dist/layui.js">
<img src="https://img.badgesize.io/layui/layui/master/dist/layui.js?compression=brotli&label=JS Brotli size" alt="JS Brotli size">
<img src="https://img.badgesize.io/layui/layui/master/dist/layui.js?compression=brotli&label=JS%20Brotli%20size" alt="JS Brotli size">
</a>
</p>

8
src/modules/table.js

@ -305,6 +305,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
,cellMaxWidth: Number.MAX_VALUE // 所有单元格默认最大宽度
,editTrigger: 'click' // 单元格编辑的事件触发方式
,defaultToolbar: ['filter', 'exports', 'print'] // 工具栏右侧图标
,defaultContextmenu: true // 显示默认上下文菜单
,autoSort: true // 是否前端自动排序。如果否,则需自主排序(通常为服务端处理好排序)
,text: {
none: '无数据'
@ -2118,9 +2119,12 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
setRowEvent.call(this, 'row');
}).on('dblclick', 'tr', function(){ //双击行
setRowEvent.call(this, 'rowDouble');
});
}).on('contextmenu', 'tr', function(e){ //菜单
if (!options.defaultContextmenu) e.preventDefault();
setRowEvent.call(this, 'contextmenu');
});;
// 创建行单击、双击事件
// 创建行单击、双击、菜单事件
var setRowEvent = function(eventType){
var othis = $(this);
if(othis.data('off')) return; //不触发事件

Loading…
Cancel
Save