layui表格自定义分页

        layui.use(['laypage', 'layer'], function () {
                    var laypage = layui.laypage;
                    //调用分页
                    laypage.render({
                        elem: 'my_page' //分页的id 
                        , count: res.result.length,
                        limit: 6
                        , jump: function (obj) {
                            var this_result = []
                            this_result = res.result.slice(obj.limit * (obj.curr - 1), obj.limit * obj.curr);
                            // console.log(this_result)
                            $("#my_table").children("tbody").empty()
                            for (var i = 0; i < this_result.length; i++) {
                                $("#my_table").children("tbody").append("" + this_result[i].name + ""
                                    + "" + this_result[i].type + ""
                                    + " " + this_result[i].status + ""
                                    + " " + this_result[i].date + ""
                                    + " " + this_result[i].progress + ""
                                    + " ")
                            }

                        }
                    });
                })

 

你可能感兴趣的:(前端)