国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

第一次記錄Bootstrap table學(xué)習(xí)筆記(1)

2024-05-06 15:17:05
字體:
供稿:網(wǎng)友

第一次使用Bootstrap-table這個(gè)表格插件,記錄一下使用過程中遇到的問題。

|引入CSS文件

<link rel="stylesheet" href="bootstrap.min.css"><link rel="stylesheet" href="bootstrap-table.css"> 

|引入相關(guān)庫

我們需要引入Jquery庫、bootstrap庫、以及bootstrap-table.js文件

<script src="jquery.min.js"></script><script src="bootstrap.min.js"></script><script src="bootstrap-table.js"></script><-- put your locale files after bootstrap-table.js --><script src="bootstrap-table-zh-CN.js"></script>

|啟用Bootstrap Table插件:

官方文檔中給出了我們有兩種那個(gè)方式來啟用bootstrap-table插件:

1、通過data屬性的方式:

<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、通過js的方式:

//只需要HTML中寫下table標(biāo)簽,并設(shè)置id<table id="table"></table>
$('#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' }]});

也可以通過url獲取數(shù)據(jù)

$('#table').bootstrapTable({ url: 'data1.json', columns: [{ field: 'id',    //與返回值的JSON數(shù)據(jù)的key值對(duì)應(yīng) title: 'Item ID'  //列名 }, { field: 'name', title: 'Item Name' }, { field: 'price', title: 'Item Price' }, ]});

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持錯(cuò)新站長站。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 华容县| 当雄县| 新乐市| 凤凰县| 基隆市| 柳林县| 江安县| 德昌县| 无为县| 涟水县| 安国市| 珠海市| 德化县| 舞阳县| 乌苏市| 江西省| 伊春市| 和平区| 张家界市| 墨脱县| 绿春县| 吉安市| 南郑县| 西畴县| 武汉市| 松桃| 大丰市| 山东省| 闽清县| 南雄市| 石台县| 天祝| 镇江市| 天台县| 南昌县| 广水市| 金川县| 西贡区| 曲水县| 运城市| 陵川县|