为了账号安全,请及时绑定邮箱和手机立即绑定

请问谁用过jqPaginator分页插件呢,该怎样动态设置总条数?

请问谁用过jqPaginator分页插件呢,该怎样动态设置总条数?

鲸与海 2017-09-07 09:31:50
$(document).ready(function () {        $.jqPaginator('#pag-cove', {        totalCounts: 9,          // 总条数     怎样动态获取这个        visiblePages: 3,          //最多显示页码        pageSize: 3,             //每页条数        currentPage: 1,         //当前页码        first: '<li class="first"><a href="javascript:;">首页</a></li>',        prev: '<li class="prev"><a href="javascript:;">上一页</a></li>',        page: '<li class="page"><a href="javascript:;">{{page}}</a></li>',        next: '<li class="next"><a href="javascript:;">下一页</a></li>',        last: '<li class="last"><a href="javascript:;">共{{totalPages}}页</a></li>',        onPageChange: function (num, type) {            pagination(num);            // 媒体报道列表            function pagination(currentPage) {                var data = {                    "parameters": "{\"pageSize\":\"3\",\"currentPage\":" + currentPage + "}"                };                $.ajax({                    type: "POST",                    dataType: "jsonp",                    jsonp: "callback",                    jsonpCallback: "jsonpCallback",                    url: adressurl.one.uri + "web/mtggList/open.do",                    data: data,                    success: function (data) {                        var appendHtml = ""                        var noticeList = data.noticeList ? data.noticeList : [];                        // var noticeCount = data.noticeCount ? data.noticeCount : [];                        for (var c = 0; c < noticeList.length; c++) {                            console.log(noticeList);                            console.log('总条数:' + noticeList.length);                            var medanewid = '';                            if (!!noticeList[c] && !!noticeList[c].id) {                                medanewid = noticeList[c].id;                            }                            console.log("id:",medanewid);                            var title = '';                            if (!!noticeList[c] && !!noticeList[c].title) {                                title = noticeList[c].title;                            }                            var content = '';                            if (!!noticeList[c] && !!noticeList[c].content) {                                content = noticeList[c].content;                            }                            var insertTime = '';                            if (!!noticeList[c] && !!noticeList[c].insertTime) {                                insertTime = noticeList[c].insertTime;                            }                            var dateType = "";                            var date = new Date();                            date.setTime(insertTime);                            dateType = date.getFullYear() + "-" + getMonth(date) + "-" + getDay(date);//yyyy-MM-dd格式日期                            var mediatitleUrl = '';                            if (!!noticeList[c] && !!noticeList[c].titleUrl) {                                mediatitleUrl = noticeList[c].titleUrl;                                var mediatitleUrljq = mediatitleUrl.substring(0, mediatitleUrl.length - 1);                            }                            appendHtml = appendHtml +                                '<li class="row cove-bot"><a target="_blank" href="details.html?id=' + medanewid + '">' +                                '<div class="col-md-3">' +                                '<img src="http://' + mediatitleUrljq + '">' +                                '</div>' +                                '<div class="col-md-9">' +                                '<h4>' + title + '<small>' + dateType + '</small></h4>' +                                '<h5>' + content + '</h5>' +                                '</div>' +                                '</li>'                        }                        $(".cove-cent-u").html(appendHtml);                    }                });                return  (num);            }        }    });});
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 3026 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信