From 13fb5d1bb5b2207a85801c701979bf9f516afc5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?=
<3277200+sentsim@users.noreply.github.com>
Date: Tue, 20 Jun 2023 00:03:16 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20table=20=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E7=94=A8=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
examples/table-test.html | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
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'