BootStrap中Table分頁插件使用詳解
分頁(Pagination),是一種無序列表,Bootstrap 像處理其他界面元素一樣處理分頁。
bootstrap-table介紹
bootstrap-table 是一個輕量級的table插件,使用AJAX獲取JSON格式的數(shù)據(jù),其分頁和數(shù)據(jù)填充很方便,支持國際化。
下載地址
https://github.com/wenzhixin/bootstrap-table/archive/1.11.0.zip
使用方式
引入css和js
<!--css樣式--> <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap/bootstrap-table.css" rel="stylesheet"> <!--js--> <script src="js/bootstrap/jquery-1.12.0.min.js" type="text/javascript"></script> <script src="js/bootstrap/bootstrap.min.js"></script> <script src="js/bootstrap/bootstrap-table.js"></script> <script src="js/bootstrap/bootstrap-table-zh-CN.js"></script>
2. table數(shù)據(jù)填充
bootstrap-table獲取數(shù)據(jù)有兩種方式,一是通過table 的data-url屬性指定數(shù)據(jù)源,二是通過JavaScript初始化表格時指定url來獲取數(shù)據(jù)
<table id="screenTable" data-toggle="table"> <thead> ... </thead> </table> $(function () { $('#screenTable').bootstrapTable({ url: "/screen/list", dataField: "rows", cache: false, //是否使用緩存,默認(rèn)為true striped: true, //是否顯示行間隔色 pagination: true, //是否顯示分頁 pageSize: 10, //每頁的記錄行數(shù) pageNumber: 1, //初始化加載第一頁,默認(rèn)第一頁 pageList: [10, 20, 50], //可供選擇的每頁的行數(shù) search: true, //是否顯示表格搜索 showRefresh: true, //是否顯示刷新按鈕 clickToSelect: true, //是否啟用點(diǎn)擊選中行 toolbar: "#toolbar_screen", //工具按鈕用哪個容器 sidePagination: "server", //分頁方式:client客戶端分頁,server服務(wù)端分頁 queryParamsType: "limit", //查詢參數(shù)組織方式 columns: [{ field: "id", title: "ID", align: "center", valign: "middle" }, { field: "name", title: "定制名稱", align: "center", valign: "middle", formatter: 'infoFormatter' }, { field: "time", title: "定制時間", align: "center", valign: "middle" }], formatNoMatches: function () { return '無符合條件的記錄'; } }); $(window).resize(function () { $('#screenTable').bootstrapTable('resetView'); }); }); function infoFormatter(value, row, index) { return '<a href=/screen/' + row.id + ' target="_blank">' + row.name + '</a>'; }
效果圖如下
以上所述是小編給大家介紹的BootStrap中Table分頁插件使用詳解,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
- bootstrap table表格插件之服務(wù)器端分頁實(shí)例代碼
- bootstrap table 服務(wù)器端分頁例子分享
- bootstrap-table后端分頁功能完整實(shí)例
- Bootstrap table分頁問題匯總
- 第一次動手實(shí)現(xiàn)bootstrap table分頁效果
- bootstrap table插件的分頁與checkbox使用詳解
- BootStrap Table前臺和后臺分頁對JSON格式的要求
- bootstrap table分頁模板和獲取表中的ID方法
- 使用bootstraptable插件實(shí)現(xiàn)表格記錄的查詢、分頁、排序操作
- bootstrap-table實(shí)現(xiàn)服務(wù)器分頁的示例 (spring 后臺)
- BootStrap Table后臺分頁時前臺刪除最后一頁所有數(shù)據(jù)refresh刷新后無數(shù)據(jù)問題
- Bootstrap table 服務(wù)器端分頁功能實(shí)現(xiàn)方法示例
相關(guān)文章
JScript中的undefined和"undefined"的區(qū)別
JScript中的undefined和"undefined"的區(qū)別...2007-03-03JavaScript快速排序(quickSort)算法的實(shí)現(xiàn)方法總結(jié)
快速排序的思想式 分治法,選一個基準(zhǔn)點(diǎn),然后根據(jù)大小進(jìn)行分配,分配然完畢之后,對已經(jīng)分配的進(jìn)行遞歸操作,最終形成快速排序,所以遞歸也是快速排序思想的一個重要組成部分,本文主要給大家介紹了JavaScript實(shí)現(xiàn)快速排序的寫法,需要的朋友可以參考下2023-11-11document.compatMode的CSS1compat使用介紹
這篇文章主要介紹了document.compatMode的CSS1compat使用,需要的朋友可以參考下2014-04-04List the Codec Files on a Computer
List the Codec Files on a Computer...2007-06-06javascript 用函數(shù)實(shí)現(xiàn)繼承詳解
下面小編就為大家?guī)硪黄猨avascript 用函數(shù)實(shí)現(xiàn)繼承詳解。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-05-05inner join 內(nèi)聯(lián)與left join 左聯(lián)的實(shí)例代碼
這篇文章主要介紹了inner join 內(nèi)聯(lián)與left join 左聯(lián)的實(shí)例代碼,需要的朋友可以參考下2017-09-09JavaScript數(shù)組去重算法實(shí)例小結(jié)
這篇文章主要介紹了JavaScript數(shù)組去重算法,結(jié)合實(shí)例形式總結(jié)分析了JavaScript數(shù)組去重相關(guān)的讀寫、遍歷、比較、排序等操作及算法改進(jìn)相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-05-05JavaScript獲取網(wǎng)頁中第一個鏈接ID的方法
這篇文章主要介紹了JavaScript獲取網(wǎng)頁中第一個鏈接ID的方法,涉及javascript中document.links方法的使用,需要的朋友可以參考下2015-04-04