<!-- 分页 -->
<div>

    <ul class="pagination am-pagination" id="pager"></ul>
    <input type="hidden" name="pageNumber" id="pageNumber" value="${pager.pageNumber}" />
<#--<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>-->
    <script type="text/javascript" src="${base}/common/js/jqPaginator/jqPaginator.min.js"></script>
    <link type="text/css" rel="stylesheet" href="${base}/common/js/jqPaginator/bootstrap.min.css"/>
    <script type="text/javascript">

        var $pageNumber = $("#pageNumber");// 当前页码
        var $pageSize = $("#pageSize");
        var path = window.location.pathname; //当前URL

        if(path.charAt(path.length - 1)=='/'){
            path = path.substring(0,path.length-1);
        }
        $.jqPaginator('#pager', {
            totalPages: ${(pager.totalPage)!10},
            totalCounts:${(pager.totalRow)!10},
            visiblePages: 7,
            currentPage: ${(pager.pageNumber)!1},
            first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
            prev: '<li class="prev"><a href="javascript:void(0);"><i class="arrow arrow2"><\/i>上一页<\/a><\/li>',
            next: '<li class="next"><a href="javascript:void(0);">下一页<i class="arrow arrow3"><\/i><\/a><\/li>',
            last: '<li class="last"><a href="javascript:void(0);">末页<\/a><\/li>',
            page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
            onPageChange: function (num, type) {
                if (type == 'change'){
                    $pageNumber.val(num);
                    var options = {};
                    var flowId = $("#flowId").val()
                    options.flowId = flowId;
                    options.pageNumber = num;

                    console.log("options = "+ JSON.stringify(options));

                    var historyParam = "?" + "pageNumber=" + num
                            + "&" + "flowId=" + flowId;
                    if($pageSize != undefined){
                        historyParam += "&pageSize=";
                        historyParam += $pageSize.val();
                        options.pageSize = $pageSize.val();
                    }
                    $("#table-container").load(path + "?ajaxCmd=userTable",options,function(){
                        History.pushState(options, "", historyParam);
                    });
                }
            }
        });
    </script>


