<html>
<head>
<%@include file="common.jspf"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="${basePath}/layui/css/layui.css" media="all">
<style type="text/css">
.layui-table-cell{ text-align:center; height: auto;}
</style>
</head>
<body>
<center>
<script src="${basePath}/layui/layui.js"></script>
<table id="goods" lay-filter="test" ></table>
<script>
layui.use('table', function(){
var table = layui.table;
//第一个实例
table.render({
elem: '#goods'
,height: 700
,width:1400
,cellMinWidth: 80
,url: '${basePath}/good/listGood.action' //数据接口
,page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
//,curr: 5 //设定初始在第 5 页
,limit:10 //一页显示多少条
,limits:[5,10,15]//每页条数的选择项
,groups: 2 //只显示 2 个连续页码
,first: "首页" //不显示首页
,last: "尾页" //不显示尾页
}
,cols: [[ //表头
{checkbox: true},
{field: 'id', title: 'ID', width:80, sort: true}
,{field: 'gname', title: '名称', width:200}
,{field: 'price', title: '价格', width:200, sort: true}
,{field: 'info', title: '详情', width:400}
,{field:'image',title: '图片',templet:'#pic',height:60}
,{field:'edit',title: '操作',templet:'#edit',height:60}
]]
});
});
</script>
<script id="pic">
<img src="${basePath}/{{d.image}}" style="height:50px;width:40px">
</script>
<script id="edit">
<button type="button" class="layui-btn layui-btn-sm " onclick="edit({{d.id}})">编辑</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del()">删除</button>
</script>
<script>
function edit(id){
alert(id);
}
</script>
</center>
</body>
</html>