<table id="tableList" lay-filter="filterTableList"></table>
<script class="layui-hide" type="text/html" id="toolbarTable">
<button class="layui-btn layui-btn-sm layui-btn-large" lay-event="saveTable" >保存</button>
</script>
table.on('event(filter)', callback);
注:event为内置事件名,filter为容器lay-filter设定的值
/*table.on('event(filter)', callback); 注:event为内置事件名,filter为容器lay-filter设定的值*/
table.render({
elem: '#tableList' // table id
,toolbar: '#toolbarTable' // table工具栏 id
});
// 工具栏事件 toolbar(lay-filter值)
table.on('toolbar(filterTableList)', function(obj){
var id = obj.config.id;
var checkStatus = table.checkStatus(id);
var othis = lay(this);
switch(obj.event){
case 'saveTable':
var data = checkStatus.data;
layer.alert(layui.util.escape(JSON.stringify(data)));
break;
};
});