|
|
|
@ -31,10 +31,8 @@
|
|
|
|
|
重载测试 |
|
|
|
|
<i class="layui-icon layui-icon-down layui-font-12"></i> |
|
|
|
|
</button> |
|
|
|
|
<button class="layui-btn layui-btn-sm layui-btn-primary" id="rowMode"> |
|
|
|
|
<span>{{= d.lineStyle ? '多行' : '单行' }}模式</span> |
|
|
|
|
<i class="layui-icon layui-icon-down layui-font-12"></i> |
|
|
|
|
</button> |
|
|
|
|
<button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="multi-row"> 多行 </button> |
|
|
|
|
<button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="default-row"> 单行 </button> |
|
|
|
|
<button class="layui-btn layui-btn-sm" id="moreTest"> |
|
|
|
|
更多测试 |
|
|
|
|
<i class="layui-icon layui-icon-down layui-font-12"></i> |
|
|
|
@ -79,12 +77,12 @@
|
|
|
|
|
|
|
|
|
|
<table id="test"></table> |
|
|
|
|
|
|
|
|
|
<script src="../src/layui.js" src1="https://cdn.staticfile.org/layui/2.7.6/layui.js"></script> |
|
|
|
|
<script src="../src/layui.js"></script> |
|
|
|
|
<script> |
|
|
|
|
(function(off){ |
|
|
|
|
if(!off) return; |
|
|
|
|
layui.disuse('table').extend({ |
|
|
|
|
table: '{/}//ww:5018/layui/2.6.13/src/modules/table' |
|
|
|
|
table: '{/}https://cdn.staticfile.org/layui/2.7.6/layui.js' |
|
|
|
|
}); |
|
|
|
|
})(); |
|
|
|
|
|
|
|
|
@ -340,38 +338,6 @@ layui.use(['table', 'dropdown'], function(){
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 行模式 |
|
|
|
|
dropdown.render({ |
|
|
|
|
elem: '#rowMode', |
|
|
|
|
data: [{ |
|
|
|
|
id: 'default-row', |
|
|
|
|
title: '单行模式(默认)' |
|
|
|
|
},{ |
|
|
|
|
id: 'multi-row', |
|
|
|
|
title: '多行模式' |
|
|
|
|
}], |
|
|
|
|
// 菜单被点击的事件 |
|
|
|
|
click: function(obj){ |
|
|
|
|
var checkStatus = table.checkStatus(id) |
|
|
|
|
var data = checkStatus.data; // 获取选中的数据 |
|
|
|
|
switch(obj.id){ |
|
|
|
|
case 'default-row': |
|
|
|
|
table.reload('test', { |
|
|
|
|
lineStyle: null // 恢复单行 |
|
|
|
|
}); |
|
|
|
|
layer.msg('已设为单行'); |
|
|
|
|
break; |
|
|
|
|
case 'multi-row': |
|
|
|
|
table.reload('test', { |
|
|
|
|
// 设置行样式,此处以设置多行高度为例。若为单行,则没必要设置改参数 - 注:v2.7.0 新增 |
|
|
|
|
lineStyle: 'height: 95px;' |
|
|
|
|
}); |
|
|
|
|
layer.msg('即通过设置 lineStyle 参数可开启多行'); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 更多测试 |
|
|
|
|
dropdown.render({ |
|
|
|
|
elem: '#moreTest', // 可绑定在任意元素中,此处以上述按钮为例 |
|
|
|
@ -474,6 +440,19 @@ layui.use(['table', 'dropdown'], function(){
|
|
|
|
|
case 'isAll': |
|
|
|
|
layer.msg(checkStatus.isAll ? '全选': '未全选') |
|
|
|
|
break; |
|
|
|
|
case 'multi-row': |
|
|
|
|
table.reload('test', { |
|
|
|
|
// 设置行样式,此处以设置多行高度为例。若为单行,则没必要设置改参数 - 注:v2.7.0 新增 |
|
|
|
|
lineStyle: 'height: 95px;' |
|
|
|
|
}); |
|
|
|
|
layer.msg('即通过设置 lineStyle 参数可开启多行'); |
|
|
|
|
break; |
|
|
|
|
case 'default-row': |
|
|
|
|
table.reload('test', { |
|
|
|
|
lineStyle: null // 恢复单行 |
|
|
|
|
}); |
|
|
|
|
layer.msg('已设为单行'); |
|
|
|
|
break; |
|
|
|
|
case 'LAYTABLE_TIPS': |
|
|
|
|
layer.alert('Table for layui-v'+ layui.v); |
|
|
|
|
break; |
|
|
|
@ -489,12 +468,7 @@ layui.use(['table', 'dropdown'], function(){
|
|
|
|
|
table.on('tool(test)', function(obj){ // 双击 toolDouble |
|
|
|
|
var data = obj.data; |
|
|
|
|
// console.log(obj) |
|
|
|
|
if(obj.event === 'del'){ |
|
|
|
|
layer.confirm('真的删除行么', function(index){ |
|
|
|
|
obj.del(); |
|
|
|
|
layer.close(index); |
|
|
|
|
}); |
|
|
|
|
} else if(obj.event === 'edit'){ |
|
|
|
|
if (obj.event === 'edit') { |
|
|
|
|
layer.prompt({ |
|
|
|
|
formType: 2 |
|
|
|
|
,value: data.email |
|
|
|
@ -512,11 +486,14 @@ layui.use(['table', 'dropdown'], function(){
|
|
|
|
|
*/ |
|
|
|
|
layer.close(index); |
|
|
|
|
}); |
|
|
|
|
} else if (obj.event === 'del') { |
|
|
|
|
layer.confirm('真的删除行么', function(index){ |
|
|
|
|
obj.del(); |
|
|
|
|
layer.close(index); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 触发表格复选框选择 |
|
|
|
|
table.on('checkbox(test)', function(obj){ |
|
|
|
|
console.log(obj) |
|
|
|
|