如何隐藏bootstrap子表中的标头

时间:2016-04-29 15:48:43

标签: javascript json twitter-bootstrap twitter-bootstrap-3 html-table

我正在尝试自定义此小提琴中的代码https://jsfiddle.net/dabros/vuLj1bcb/

var $table = $('#table');
$(function() {

 $table.bootstrapTable({
columns: [{
  field: 'col1',
  title: 'Col1'
}, {
  field: 'col2',
  title: 'Col2'
}],
data: data,
detailView: true,
onExpandRow: function(index, row, $detail) {
  console.log(row)
  $detail.html('<table></table>').find('table').bootstrapTable({
    columns: [{
      field: 'col3',
      title: 'Col3'
    }, {
      field: 'col4',
      title: 'Col4'
    }, {
      field: 'col5',
      title: 'Col5'
    }],
    data: row.nested,
    // Simple contextual, assumes all entries have further nesting
    // Just shows example of how you might differentiate some rows, though also remember row class and similar possible flags
    detailView: row.nested[0]['other'] !== undefined,
    onExpandRow: function(indexb, rowb, $detailb) {
      $detailb.html('<table></table>').find('table').bootstrapTable({
        columns: [{
          field: 'col6',
          title: 'Col6'
        }, {
          field: 'col7',
          title: 'Col7'
        }],
        data: rowb.other
          });
        }
      });

   }
  });
});

以便不显示子表的标题。很明显,我必须使用类似&#39; display:none&#39;对于标题但我无法在哪里进行更改。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

在文件中:
http://bootstrap-table.wenzhixin.net.cn/documentation/
您可以将选项showHeader设置为false 表格选项在jQuery.fn.bootstrapTable.defaults

中定义

由于您可能想要使用他们的CDN,您可以在表格的display: none元素上添加thead