今天就跟大家聊聊有關(guān)bootstrap中怎么利用table綁定數(shù)據(jù),可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
支持三種方式bootstrap table綁定數(shù)據(jù):1.html格式數(shù)據(jù)(即靜態(tài)數(shù)據(jù));2.JavaScript傳遞數(shù)據(jù);3.數(shù)據(jù)屬性變量動態(tài)獲取。
靜態(tài)表格:data-toggle="table"
<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>
JavaScript方式
<table id="table"></table><!--定義一個(gè)表格,無需設(shè)置表頭,統(tǒng)一在JS中初始化,靈活度較高(梁新建議)--><script>$('#table').bootstrapTable({ url: 'data1.json', pagination: true, search: true columns: [{ field: 'id', title: 'Item ID' }, { field: 'name', title: 'Item Name' }, { field: 'price', title: 'Item Price' }, ]})</script>
數(shù)據(jù)屬性變量動態(tài)獲取
<table data-toggle="table" data-url="data1.json" data-pagination="true" data-search="true"> <thead> <tr> <th data-sortable="true" data-field="id">Item ID</th> <th data-field="name">Item Name</th> <th data-field="price">Item Price</th> </tr> </thead></table>
看完上述內(nèi)容,你們對bootstrap中怎么利用table綁定數(shù)據(jù)有進(jìn)一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。
新聞標(biāo)題:bootstrap中怎么利用table綁定數(shù)據(jù)-創(chuàng)新互聯(lián)
網(wǎng)頁鏈接:http://www.rwnh.cn/article2/ceijoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信小程序、小程序開發(fā)、App開發(fā)、網(wǎng)站導(dǎo)航、動態(tài)網(wǎng)站、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容