1、主表中设置data-detail-view="true",启用主子表模式:
striped="true"
data-height="430" data-detail-view="true" data-detail-formatter="getChildTable"
data-pagination="true" sidePagination="server" data-click-to-select="true">
2、JS动态创建子表,关键的是$detail.html('
').find('table');,这里创建了一个table,并给table设置了id,非常重要,不设置的话后续无法刷新子表:function getChildTable(index, row, $detail) {
var parentid = row.tpno;
// console.log(row);
var cur_table = $detail.html('
').find('table');$(cur_table).bootstrapTable({
url: '/etestpaper/getPaperQType',
method: 'get',
queryParams: {strParentID: parentid},
ajaxOptions: {strParentID: parentid},
sho