You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<title>layui</title>
|
|
|
|
|
<meta name="renderer" content="webkit">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
|
|
|
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
|
|
|
|
|
<!-- 注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的 -->
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<table class="layui-hide" id="test"></table>
|
|
|
|
|
|
|
|
|
|
<script src="__STATIC__/layui2/layui.js"></script>
|
|
|
|
|
<!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
layui.use('table', function(){
|
|
|
|
|
var table = layui.table;
|
|
|
|
|
|
|
|
|
|
table.render({
|
|
|
|
|
elem: '#test'
|
|
|
|
|
,url:'{:U("data")}'
|
|
|
|
|
,cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
|
|
|
|
,cols: [[
|
|
|
|
|
{field:'id', width:80, title: 'ID', sort: true}
|
|
|
|
|
,{field:'username', width:80, title: '用户名'}
|
|
|
|
|
,{field:'sex', width:80, title: '性别', sort: true}
|
|
|
|
|
,{field:'city', width:80, title: '城市'}
|
|
|
|
|
|
|
|
|
|
]]
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|