bootstraptable方法之expandRow-collapseRow展開或關(guān)閉當前行數(shù)據(jù)

本文實例為大家分享了bootstrap table展開或關(guān)閉當前行數(shù)據(jù)的具體代碼,供大家參考,具體內(nèi)容如下

創(chuàng)新互聯(lián)公司于2013年創(chuàng)立,先為甘南等服務(wù)建站,甘南等地企業(yè),進行企業(yè)商務(wù)咨詢服務(wù)。為甘南企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

<!DOCTYPE html>
<html>
<head>
 <title>expandRow-collapseRow</title>
 <meta charset="utf-8">
 <link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css" rel="external nofollow" >
 <link rel="stylesheet" href="../assets/bootstrap-table/src/bootstrap-table.css" rel="external nofollow" >
 <link rel="stylesheet" href="../assets/examples.css" rel="external nofollow" >
 <script src="../assets/jquery.min.js"></script>
 <script src="../assets/bootstrap/js/bootstrap.min.js"></script>
 <script src="../assets/bootstrap-table/src/bootstrap-table.js"></script>
 <script src="../ga.js"></script>
</head>
<body>
 <div class="container">
 <h2>expandRow-collapseRow</h2>
 <p></p>
 <div id="toolbar">
  <button id="button" class="btn btn-default">expandRow</button>
  <button id="button2" class="btn btn-default">collapseRow</button>
 </div>
 <table id="table"
  data-toggle="table"
  data-toolbar="#toolbar"
  data-height="460"
  data-detail-view="true"
  data-detail-formatter="detailFormatter"
  data-url="../json/data1.json">
  <thead>
  <tr>
  <th data-field="id">ID</th>
  <th data-field="name">Item Name</th>
  <th data-field="price">Item Price</th>
  </tr>
  </thead>
 </table>
 </div>
<script>
 var $table = $('#table'),
 $button = $('#button'),
 $button2 = $('#button2');

 $(function () {
 $button.click(function () {
  $table.bootstrapTable('expandRow', 1);
 });
 $button2.click(function () {
  $table.bootstrapTable('collapseRow', 1);
 });
 });

 function detailFormatter(index, row) {
 var html = [];
 $.each(row, function (key, value) {
  html.push('<p><b>' + key + ':</b> ' + value + '</p>');
 });
 return html.join('');
 }
</script>
</body>
</html>

官方演示地址

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。

分享名稱:bootstraptable方法之expandRow-collapseRow展開或關(guān)閉當前行數(shù)據(jù)
分享鏈接:http://muchs.cn/article26/picccg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、軟件開發(fā)、品牌網(wǎng)站設(shè)計建站公司、標簽優(yōu)化網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作