前端分頁外掛程式bootstrapPaginator的使用

來源:互聯網
上載者:User

標籤:name   OLE   des   esc   desc   頁面切換   too   his   eal   

 
<table class="table table-striped table-bordered table-hover dataTable no-footer" role="grid" aria-describedby="sample_2_info">                        <thead>                            <tr role="row">                                <th tabindex="0" aria-label="">                                    **                                </th>                                <th tabindex="0" aria-label="">                                    **                                </th>                                <th tabindex="0" aria-label="">                                   **                                </th>                                <th tabindex="0" aria-label="">                                    **                                </th>                                <th tabindex="0" aria-label="">                                    **                                </th>                                <th tabindex="0" aria-label="">                                    **                                </th>                                <th tabindex="0" aria-label="">                                    **                                </th>                                <th tabindex="0" aria-label="">                                    **                                </th>                            </tr>                        </thead>                        <tbody id="tableBody"></tbody>                    </table>                    <div class="paging-toolbar">                        <ul id="grid_paging_part"></ul>                    </div>
<script>$(function () {           loadTables(1, 10);    });    function loadTables(startPage, pageSize) {        $("#tableBody").html("");        $.ajax({            type: "GET",            url: "/Transaction/GetRecordList?startPage=" + startPage + "&pageSize=" + pageSize,            success: function (data) {                $.each(data.rows, function (i, item) {                    var tr = "<tr>";                    tr += "<td>" + item.orderId + "</td>";                    tr += "<td>" + item.appName + "</td>";                    tr += "<td>" + item.realName + "</td>";                    tr += "<td>" + item.accountTypeName + "</td>";                    tr += "<td>" + item.transAmount + "</td>";                    tr += "<td>" + item.transTime.replace("T", " ") + "</td>";                    if (item.transType == ‘1‘) {                        tr += "<td>**</td>";                    }                    if (item.transType == ‘2‘) {                        tr += "<td>**</td>";                    }                    if (item.flag == ‘0‘) {                        tr += "<td>**</td>";                    }                    else {                        tr += "<td>**</td>";                    }                    tr += "</tr>";                    $("#tableBody").append(tr);                })                var elment = $("#grid_paging_part"); //分頁外掛程式的容器id                if (data.rowCount > 0) {                    var options = { //分頁外掛程式配置項                        bootstrapMajorVersion: 3,                        currentPage: startPage, //當前頁                        numberOfPages: data.rowsCount, //總數                        totalPages: data.pageCount, //總頁數                        shouldShowPage: function (type, page, current) {                            var result = !0;                            switch (type) {                                case "first":                                    result = 1 !== current;                                    break;                                case "prev":                                    result = 1 !== current;                                    break;                                case "next":                                    result = current !== this.totalPages;                                    break;                                case "last":                                    result = current !== this.totalPages;                                    break;                                case "page":                                    result = !0                            }                            return result                        },                        itemTexts: function (type, page, current) {//設定顯示的樣式,預設是箭頭                            switch (type) {                                case "first":                                    return "首頁";                                case "prev":                                    return "上一頁";                                case "next":                                    return "下一頁";                                case "last":                                    return "末頁";                                case "page":                                    return page;                            }                        },                        onPageChanged: function (event, oldPage, newPage) { //頁面切換事件                            loadTables(newPage, pageSize);                        }                    }                    elment.bootstrapPaginator(options); //分頁外掛程式初始化                }            }        })    };</script>

 

前端分頁外掛程式bootstrapPaginator的使用

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.