2016-03-24 22 views
0

我想改變文字信息引導表格的表頭樣式,但是class =「info」不起作用。 有一個代碼:如何更改header wenzhixin bootstrap-table的樣式?

<table data-toggle="table" data-height="700" data-classes="table table-striped table-bordered table-hover"> 
 
    <thead> 
 
     <tr class="info"> <!--it doesn't work--> 
 
      <th>Item ID</th> 
 
      <th>Item Name</th> 
 
      <th>Item Price</th> 
 
     </tr> 
 
    </thead> 
 
    <tbody> 
 
     <tr> 
 
      <th>0</th> 
 
      <th>Item 0</th> 
 
      <th>10</th> 
 
     </tr> 
 
    </tbody> 
 
</table>

請幫助。如何更改標題引導表的樣式?

P.S.如果沒有wenzhixin引導表使用引導程序,然後一切正常,但對我來說是必要wenzhixin引導表

回答

0

取而代之的是data-classes屬性的,如果你只使用class,問題是在火狐,Chrome和IE7 +解決。

問候,希望它能解決您的問題。

0

請與:

<style> 
     #tableID thead tr{ 
      background-color: #0361cc; color:white; 
     } 
</style> 
0

我有同樣的問題。 bootstrap-tablethead,tr,th標籤中刪除類和樣式。如果您也使用stickyTableHeaders(背景不會是白色但透明),這更令人沮喪。 bootstrap-table提供了一個load-success事件,該事件在表被渲染後觸發。之後你可以使用它將類/樣式附加到表中。要知道,你的表需要一個id

$('#myTable').on('load-success.bs.table', function (e, data) { 
    $('#myTable').stickyTableHeaders(); 
    $('#myTable thead tr').css('background','white'); 
}); 

因此,要完成剪斷,這樣的事情應該工作:

<table id="myTable" data-toggle="table" data-height="700" data-classes="table table-striped table-bordered table-hover"> 
    <thead> 
     <tr class="info"> <!--it doesn't work--> 
      <th>Item ID</th> 
      <th>Item Name</th> 
      <th>Item Price</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <th>0</th> 
      <th>Item 0</th> 
      <th>10</th> 
     </tr> 
    </tbody> 
</table> 
<script> 
    $('#myTable').on('load-success.bs.table', function (e, data) { 
     $('#myTable thead tr').css('background','pink'); 
    }); 
</script>