layui分页失效问题

真的崩溃,怎么都实现不了分页效果。获取数据11条,设置显示8条,它显示11条。

后来看一个大佬的文章:https://blog.csdn.net/qq_38642674/article/details/105487465

自己做一个备忘。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
layui.use('table', function(){
            var table = layui.table;
            $.ajax({
                type: "POST",
                url: "/adminInfoReal/getListAdminInfoReal",
                dataType: "json"
                ,success:function (datal) {
                    if (datal){
                        var option={
                            elem: '#adminRealTable'//table的id
                            ,height: 480
                            ,page:true
                            ,limit:8
                            ,title: '用户数据表'
                            ,cols: [[ //表头
                                {type: 'checkbox', fixed: 'left'}//开启复选框
                                ,{field: 'adminRealUserId', title: '身份证号', width:100, sort: true, fixed: 'left'}
                                ,{field: 'adminRealName', title: '姓名', width:100}
                                ,{field: 'adminRealPhone', title: '手机号', width:100, sort: true}
                                ,{field: 'adminRealEmail', title: '邮箱', width:100}
                                ,{field: 'adminRealAddress', title: '城市', width: 6000}
                                ,{ title:'操作', toolbar: '#barDemo',width:150, sort: true,fixed: 'right'}
                            ]]
                        };
                        option.data=datal.data;
                        table.render(option);
                    }else{
                        layer.msg("数据获取失败");
                    }
                }
                ,error:function (datal) {
                    layer.msg("数据获取失败");
                }
            });
 });

  

posted on   迷途行者  阅读(1265)  评论(0编辑  收藏  举报

导航

< 2025年1月 >
29 30 31 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示