bootstrap table方法之expandRow-collapseRow展開或關(guān)閉當(dāng)前行數(shù)據(jù)
更新時(shí)間:2020年08月09日 09:35:11 作者:黃德根
這篇文章主要為大家詳細(xì)介紹了bootstrap table方法之expandRow-collapseRow展開或關(guān)閉當(dāng)前行數(shù)據(jù),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家分享了bootstrap table展開或關(guān)閉當(dāng)前行數(shù)據(jù)的具體代碼,供大家參考,具體內(nèi)容如下
<!DOCTYPE html> <html> <head> <title>expandRow-collapseRow</title> <meta charset="utf-8"> <link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css" > <link rel="stylesheet" href="../assets/bootstrap-table/src/bootstrap-table.css" > <link rel="stylesheet" href="../assets/examples.css" > <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"> <h1>expandRow-collapseRow</h1> <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í)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Javascript中String的常用方法實(shí)例分析
這篇文章主要介紹了Javascript中String的常用方法,實(shí)例分析了String常用的字符轉(zhuǎn)換、截取、分割等技巧,需要的朋友可以參考下2015-06-06微信小程序?qū)崿F(xiàn)可拖動懸浮圖標(biāo)的示例代碼
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)可拖動懸浮圖標(biāo)的示例代碼,本文通過示例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2023-12-12Window.Open如何在同一個(gè)標(biāo)簽頁打開
這篇文章主要介紹了Window.Open如何在同一個(gè)標(biāo)簽頁打開,需要的朋友可以參考下2014-06-06JS 實(shí)現(xiàn)可停頓的垂直滾動實(shí)例代碼
下面小編就為大家?guī)硪黄狫S 實(shí)現(xiàn)可停頓的垂直滾動實(shí)例代碼。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-11-11基于Node.js的JavaScript項(xiàng)目構(gòu)建工具gulp的使用教程
也許你使用過grunt,那么這里來安利gulp的話就更加不會陌生了,下面我們就來看一下基于Node.js的JavaScript項(xiàng)目構(gòu)建工具gulp的使用教程2016-05-05