Bootstrap Table使用整理(一)
相關(guān)閱讀:
Bootstrap Table使用整理(二) http://www.dhdzp.com/article/115791.htm
Bootstrap Table使用整理(三) http://www.dhdzp.com/article/115795.htm
Bootstrap Table使用整理(四)之工具欄 http://www.dhdzp.com/article/115798.htm
Bootstrap Table使用整理(五)之分頁組合查詢 http://www.dhdzp.com/article/115785.htm
一、Bootstrap Table相關(guān)整理
基于 Bootstrap 的 jQuery 表格插件,通過簡單的設(shè)置,就可以擁有強(qiáng)大的單選、多選、排序、分頁,以及編輯、導(dǎo)出、過濾(擴(kuò)展)等等的功能。
1.官網(wǎng)地址:
http://bootstrap-table.wenzhixin.net.cn/zh-cn/ Git源代碼地址:https://github.com/wenzhixin/bootstrap-table
基礎(chǔ)簡介:
http://bootstrap-table.wenzhixin.net.cn/zh-cn/getting-started/
使用示例:
http://bootstrap-table.wenzhixin.net.cn/zh-cn/examples/
API文檔:
http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
Bootstrap Table的有點使用簡單,美觀整潔,支持CardView等特點
二、簡單使用實例
基礎(chǔ)引用
<link href="~/lib/bootstrap-table/dist/bootstrap-table.css" rel="external nofollow" rel="stylesheet" /> <script src="~/lib/bootstrap-table/dist/bootstrap-table.js"></script> <script src="~/lib/bootstrap-table/src/locale/bootstrap-table-zh-CN.js"></script>
1.data-toggle="table" 無需JavaScript啟用bootstrap table
<p>通過Data屬性的方式,無需編寫JavaScript啟用bootstrap table, 設(shè)置 data-toggle="table" 即可</p> <div class="alert alert-danger"> <p>1.這種方式不太常用,因為分頁不方便</p> </div> <table data-toggle="table"> <thead> <tr> <th>Item ID</th> <th>Item Name</th> <th>Item Price</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Item 1</td> <td>$1</td> </tr> <tr> <td>2</td> <td>Item 2</td> <td>$2</td> </tr> </tbody> </table>
2.使用data-url指定遠(yuǎn)程數(shù)據(jù),特別說明,在使用遠(yuǎn)程數(shù)據(jù)的時候,在ajax請求期間,表格內(nèi)容顯示加載中...,
<p>可以通過設(shè)置遠(yuǎn)程url 如:data-url="data1.json" ,自動加載遠(yuǎn)程數(shù)據(jù)</p>
<div class="alert alert-danger">
<p>1.這種方式對于分頁不太方便</p>
<p>2.BootstrapTable 對于字段中為空,自動替換成'-'</p>
</div>
<table data-toggle="table" data-url="@Url.Action("GetStudent","DataOne")">
<thead>
<tr>
<th data-field="sno">編號</th>
<th data-field="sname">姓名</th>
<th data-field="ssex">性別</th>
<th data-field="sbirthday">生日</th>
<th data-field="class">課程編號</th>
</tr>
</thead>
</table>


3.data-classes 屬性指定表格的樣式,
特別說明:表頭和屬性的指定方式有兩種,一種DOM中定義,一種在Js的參數(shù)中定義
<table id="table1"
data-classes="table table-hover table-condensed"></table>
[javascript] view plain copy print?
//data-classes 可以設(shè)置樣式
/*
* table-condensed 設(shè)置內(nèi)容框濃縮
*/
$('#table1').bootstrapTable({
columns: [
{ field: 'sno', title: '學(xué)生編號' },
{ field: 'sname', title: '學(xué)生姓名' },
{ field: 'ssex', title: '性別' },
{ field: 'sbirthday', title: '生日' },
{ field: 'class', title: '課程編號' },
],
url:'@Url.Action("GetStudent","DataOne")'
});
table-condensed 表格緊湊樣式顯示如下:

以上所述是小編給大家介紹的Bootstrap Table使用整理(一),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
javascript dom 操作詳解 js加強(qiáng)
javascript dom 操作詳解 js加強(qiáng)操作實現(xiàn)代碼。2009-07-07
electronjs實現(xiàn)打開的網(wǎng)頁密碼自動保存功能(實現(xiàn)步驟)
在 Electron 的渲染進(jìn)程中,可以使用 webContents 對象來監(jiān)聽網(wǎng)絡(luò)請求,在 Electron 中實現(xiàn)自動保存網(wǎng)頁密碼的功能涉及到幾個步驟,下面給大家分享實現(xiàn)思路,感興趣的朋友跟隨小編一起看看吧2024-08-08
利用jsPDF實現(xiàn)將圖片轉(zhuǎn)為pdf
這篇文章主要為大家詳細(xì)介紹了如何利用jsPDF實現(xiàn)將圖片轉(zhuǎn)為pdf的功能,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起了解一下2023-08-08
基于webpack-hot-middleware熱加載相關(guān)錯誤的解決方法
下面小編就為大家分享一篇基于webpack-hot-middleware熱加載相關(guān)錯誤的解決方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-02-02

