diff --git a/examples/table-test.html b/examples/table-test.html index 24b407a4..33dea7be 100644 --- a/examples/table-test.html +++ b/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:'用户名 ', width:120, edit: function(d){ return !d.LAY_DISABLED; }, templet: '#usernameTpl'} ,{field:'xxx', title:'测试', edit: 'text'} - ,{field:'email', minWidth: 160, maxWidth: 320, title:'邮箱 ', fieldTitle: '邮箱', hide: 0, edit: 'text', templet: function(d){ + ,{field:'email', minWidth: 160, maxWidth: 320, title:'邮箱 ', fieldTitle: '邮箱', hide: 0, edit: 'text', templet: function(d){ return ''+ layui.util.escape(d.email) +'' }} ,{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'