layui table表格分页全选获取值效果代码

代码语言:html

所属分类:表格

代码描述:layui table表格分页全选获取值效果代码

代码标签: 分页 全选 取值 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!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">
    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/js/layui/css/layui.css">
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/layui/layui.all.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/mock.min.js"></script>
    <!-- 注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的 -->
</head>
<body>
    <div style="margin-bottom: 5px;">



    </div>

    <div class="layui-btn-group demoTable">
        <button class="layui-btn" data-type="getCheckData">获取选中行数据</button>
        <button class="layui-btn" data-type="getCheckLength">获取选中数目</button>
        <button class="layui-btn" data-type="isAll">验证是否全选</button>
    </div>

    <table id="idTest">
        <thead>
            <tr>
              
            </tr>
        </thead>
    </table>

    <script type="text/html" id="barDemo"> <a class = "layui-btn layui-btn-primary layui-btn-xs" lay-event = "detail" > 查看 </a> <a class = "layui-btn layui-btn-xs" lay-event = "edit" > 编辑 </a> <a class = "layui-btn layui-btn-danger layui-btn-xs" lay-event = "del" > 删除 </a>
    </script>

    <script>
        Mock.mock(/\/demo\/[\s\S]*?/,
            {
                "code": 0,
                "msg": "",
                "count": 40,
                "data|5": [{


                    "id": 10001, "username": "user-1", "sex": "男", "city": "城市-1", "sign": "签名-1", "experience": 884, "logins": 58, "wealth": 64928690, "classify": "词人", "score": 27
                },

                ]

            }

        );
        layui.use('table', function() {
            var table = layui.table;
            table.render({
               toolbar: 'default' ,
                elem: '#idTest', url: '/demo/table/user/', cols: [[{
                    type: 'checkbox',field: 'id',  width: 80,fixed: 'left'
                },{
                    field: 'id', width: 80, title: 'ID', sort: true
                }, {
                    field: 'username', width: 8.........完整代码请登录后点击上方下载按钮下载查看

网友评论0