資料: 官網 2017.7.10javascript
入門實例css
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap Table</title> <link href="Styles/css/bootstrap.min.css" rel="stylesheet" /> <link href="Styles/css/bootstrap-table.min.css" rel="stylesheet" /> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <script src="Scripts/Core/jquery-1.12.4.min.js" type="text/javascript"></script> <script src="Scripts/Core/bootstrap.min.js"></script> <script src="Scripts/Extensions/bootstrap-table.js"></script> <script src="Scripts/Extensions/bootstrap-table-locale-all.js"></script> <script src="Scripts/Main.js"></script> </head> <body> <table id="table"></table> </body> </html
經過JavaScript激活Bootstrap Table, coding在Main.js內html
$(function () { $('#table').bootstrapTable({ columns: [{ field: 'id', title: 'Item ID' }, { field: 'name', title: 'Item Name' }, { field: 'price', title: 'Item Price' }], data: [{ id: 1, name: 'Item 1', price: '$1' }, { id: 2, name: 'Item 2', price: '$2' }] }) })
內置方法:bootstrapTable(), 內置屬性: columns, data 請參看Documenthtml5
PS:閱讀Bootstrap Table Documentjava
上面的HTML <table id="table"></table> ,Bootstrap Table會將其絢爛成tablejquery
和bootstrap Table Document的對應關係,bootstrap
表示bootstrapTable插件中的classes會被轉成Attribute(屬性),字面值data-classes, 關於data-[xxx]語法,請參考bootstrap的data-api用法.api