2017-08-04 4 views
0

だから、ヘッダを除いてテーブル行にクラスを追加したいが、どうやってそれを行うのか分からない。誰かが私がこれをどうやってできるか知っていますか?動的ブートストラップテーブル行にクラスを追加する

これが私のテーブルです:

<table id="table" class="hidden table table-bordered table-striped table-hover"> 
    <thead> 
     <tr> 
      <th data-field="variant">Variant</th> 
      <th data-field="description">Description</th> 
     </tr> 
    </thead> 
</table> 

と私はデータを追加し、

$('#table').bootstrapTable({ 
    data: returnValue 
}); 
+1

をドキュメントを読むようにldは、あなたが情報のpeiceが解決に有用であると考えて何かいけないこと? – jidexl21

答えて

0

第一行にクラスを追加する場所これは、現在、次のとおりです。 HTMLでtbodyのタグを追加しますtable

第2:単純加算彼はクラスのみこの

$('#table tbody tr').addClass("newclass"); 

HTMLのようなあなたtbody tr用:

<table id="table" class="hidden table table-bordered table-striped table-hover"> 
    <thead> 
     <tr> 
      <th data-field="variant">Variant</th> 
      <th data-field="description">Description</th> 
     </tr> 
    </thead> 
    <tbody> //tbody added here 
     <tr> 
     .... 
     </tr> 
    </tbody> 
</table> 

jqueryので

$('#table tbody tr').addClass("newclass"); 
1

ブートストラップ・テーブルのドキュメントを見て、行のスタイルプロパティを使用し、 私はそのプラグインに精通していませんが、私はそれをshouと推測しますこの

$('#table').bootstrapTable({ 
    data: returnValue, 
    rowStyle : function(row, index) { 
    return { 
    classes: 'text-nowrap another-class', 
    css: {"color": "blue", "font-size": "50px"} 
    }; 
} 
}); 

あなたはbootstrapTableプラグインを使用している、ここでhttp://bootstrap-table.wenzhixin.net.cn/documentation/

関連する問題