layui table的<td>内加入select相关问题
1:下拉显示不全问题
.layui-table-cell, .layui-table-tool-panel li {
overflow: visible !important;
}
.layui-form-select .layui-input {
height: 30px;
}
.layui-table-box {
overflow: visible !important;
}
.layui-table-body {
overflow: visible !important;
}
2:表格相关
//表头
var cols = [ //表头
{type: 'numbers', title: 'XXX', align: "center"}
, {field: 'XXX', title: 'XXX', sort: true, align: "center"}
, {field: 'XXX', title: 'XXX', sort: true, align: "center"}
, {field: 'XXX', title: 'XXX', sort: true, align: "center"}
, { field: 'XXX', title: 'XXX', sort: true, align: "center",templet: function (d) {
return d.XXX== null ? '' : '****';
}
}
, {field:'caozuo', title: '操作',totalRow:true, width: 260, align: "center",templet:function (res) {
return colShow_DATA_Do(res);
}
}
];
var height = $(window).height(), width = $(window).width();
//执行一个 table 实例
doTableInit(table, '#demo', height - 20, '/XXX/XXX', '#toolbarDemo', false, [], cols, "XXXTable", true);
function doTableInit(table, tableId, height, url, toolbar, totalRowFlag, defaultToolbar, cols, id, pageFlag){
table.render({
elem: tableId
,height: height
,url: url //数据接口
,toolbar: toolbar
,totalRow: totalRowFlag //开启合计行
,defaultToolbar: defaultToolbar
,cellMinWidth: 60 //全局定义常规单元格的最小宽度,layui 2.2.1 新增
,cols: [cols]
,id: id
,page: pageFlag //开启分页
,limit:20
});
}
function colShow_DATA_Do(data) {
var result = "";
result+= '<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
return result;
}