本文共 705 字,大约阅读时间需要 2 分钟。
expandRow
collapseRow
data-toggle="table"
data-toolbar="#toolbar"
data-height="460"
data-detail-view="true"
data-detail-formatter="detailFormatter"
data-url="../json/data1.json">
IDItem NameItem Price
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('
' + key + ': ' + value + '
');});
return html.join('');
}
转自:http://www.cnblogs.com/huangdegen/articles/5479021.html