Browse Source

更新 table 测试用例

pull/1287/head
贤心 1 year ago
parent
commit
13fb5d1bb5
  1. 13
      examples/table-test.html

13
examples/table-test.html

@ -157,11 +157,11 @@ layui.use(['table', 'dropdown'], function(){
{type: 'checkbox', fixed: 'left'}
//,{type: 'numbers', fixed: 'left'}
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
,{field:'username', title:'用户名', width:120, edit: function(d){
,{field:'username', title:'用户名 <i class="layui-icon layui-icon-username" lay-event="username"></i>', width:120, edit: function(d){
return !d.LAY_DISABLED;
}, templet: '#usernameTpl'}
,{field:'xxx', title:'测试', edit: 'text'}
,{field:'email', minWidth: 160, maxWidth: 320, title:'邮箱 <i class="layui-icon layui-icon-email"></i>', fieldTitle: '邮箱', hide: 0, edit: 'text', templet: function(d){
,{field:'email', minWidth: 160, maxWidth: 320, title:'邮箱 <i class="layui-icon layui-icon-email" lay-event="email"></i>', fieldTitle: '邮箱', hide: 0, edit: 'text', templet: function(d){
return '<em>'+ layui.util.escape(d.email) +'</em>'
}}
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true, escape: false}
@ -421,7 +421,7 @@ layui.use(['table', 'dropdown'], function(){
});
});
// 工具栏事件
// 头部工具栏事件
table.on('toolbar(test)', function(obj){
var id = obj.config.id;
var checkStatus = table.checkStatus(id);
@ -445,6 +445,11 @@ layui.use(['table', 'dropdown'], function(){
};
});
// 表头自定义元素工具事件
table.on('colTool(test)', function(obj){
console.log(obj);
});
//触发单元格工具事件
table.on('tool(test)', function(obj){ // 双击 toolDouble
var data = obj.data;
@ -489,7 +494,7 @@ layui.use(['table', 'dropdown'], function(){
// 行单击事件
table.on('row(test)', function(obj){
// console.log(obj);
console.log(obj);
// layer.closeAll('tips');
obj.setRowChecked({
// type: 'radio'

Loading…
Cancel
Save