码迷,mamicode.com
首页 > Web开发 > 详细

pagination.js 使用

时间:2018-10-23 18:04:48      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:ref   self   template   date   create   col   mat   hidden   ica   

 pagination.js 

使用方式

$(‘.paginationjs‘).pagination({
            dataSource: ‘DetailImage?handler=Search‘,
            locator: ‘rows‘,
            //totalNumber: 120,
            totalNumberLocator: function (response) {
                return response.total;
            },
            pageSize: 12,
            alias: {
                pageNumber: "PageIndex",
                pageSize:"PageSize"
            },
            ajax: {
                //beforeSend: function () {
                //    dataContainer.html(‘Loading data from flickr.com ...‘);
                //}
                type: "POST",
                //url: "DetailImage?handler=Search",
                data: req,
                dataType: ‘json‘,
                //contentType: "application/json",
                headers: {
                    "RequestVerificationToken": $(‘input:hidden[name="__RequestVerificationToken"]‘).val()
                },
            },
            callback: function (data, pagination) {
                // template method of yourself
                var temp = pagination; 
                //var html = template(data);
                //dataContainer.html(html);

                var html = "";
                $.each(data, function (index, item) {
                    html += ‘<div class="col-sm-6 col-md-3"> ‘
                    html += ‘<div class="thumbnail"> ‘
                    html += ‘   <img src="/api/image/‘ + item.ImageId + ‘" alt="..." width=600, height=600>‘
                    html += ‘        <div class="caption">‘
                    html += ‘            <h3>‘ + item.CreateDateTime + ‘</h3>‘
                    //html +=            ‘<p>...</p>‘
                    //html +=‘            <p><a href="#" class="btn btn-primary" role="button">Button</a> <a href="#" class="btn btn-default" role="button">Button</a></p>‘
                    html += ‘        </div>‘
                    html += ‘</div>‘
                    html += ‘</div>‘
                });

                $("#data-container").html(html);
                //dataContainer.html(html);

            },
            formatResult: function (data) {
                

                //return html;
            },

  

pagination.js 使用

标签:ref   self   template   date   create   col   mat   hidden   ica   

原文地址:https://www.cnblogs.com/xiaoyu369/p/9837603.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!