2011-12-05 20 views
-1

データを表示するためにJquery DataTableを使用しています。Jquery DataTable:テーブルヘッダーが2回表示されます

<style type="text/css" title="currentStyle"> 
    @import '../css/demo_page.css'; 
    @import '../css/demo_table.css'; 
</style> 
<script type="text/javascript" language="javascript" src="../scripts/jquery.js"></script> 
<script type="text/javascript" language="javascript" src="../scripts/jquery.dataTables.js"></script> 

<script type="text/javascript" charset="utf-8"> 
    $(document).ready(function() { 
     $('#example1').dataTable({ 
      "bAutoWidth": false, 
      "sScrollX": "100%", 
      "bPaginate": false 
     }); 
    }); 
</script>             

<div id="demo"> 
    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example1" > 
     <thead> 
      <tr> 
       <th>Query GeneID</th> 
       <th>Hit GeneID</th> 
       <th>EXON</th> 
       <th>Percentage</th> 
       <th>Align Length</th> 
       <th>No. of Mismatch</th> 
       <th>Gaps</th> 
       <th>Start Query Gene</th> 
       <th>End Query Gene</th> 
       <th>Hit Gene Start </th> 
       <th>End Gene Start</th> 
       <th>E-Value</th> 
       <th>Bit-Score</th> 
      </tr> 
     </thead> 
     <tbody> 
      <tr> 
       <td> AA1</td> 
       <td>AA3</td> 
       <td>AAAAAAAAAAAAA</td> 
       <td>AA3</td> 
       <td> AA1</td> 
       <td> AA1</td> 
       <td> AA1</td> 
       <td> AA1</td> 
       <td> AA1</td> 
       <td> AA1</td> 
       <td>AA1</td> 
       <td>AA1</td> 
       <td>AA1</td> 
      </tr> 
     </tbody> 
    </table> 
</div> 

私がページをヒットしようとすると、データが二回登場<th>内のすべてのフィールドで示されてきています。 は私が削除した場合:

"bAutoWidth": false, 
"sScrollX": "100%", 
"bPaginate": false 

は、その後のヘッダーが正しく表示されている、私はスクロールを維持したいデータができるようにスクロールさせるために有効。

私が間違っている場所を教えてください。

おかげで、 カピル

+0

私はJavaスクリプトエラー取得しています:キャッチされない例外TypeErrorを:オブジェクト#は、方法はありません 'outerWidthの' ファイルに:jqueryの.dataTables.min.js – KAPILP

+0

私は再現しようとすると問題は発生しません:http://live.datatables.net/adayaz/edit#javascript,html –

+0

グレッグのリンクをありがとう、私は''このコードを含めると、動作し始めました – KAPILP

答えて

-1

は、このスタイルを含める:

div.FixedHeader_Cloned th, 
div.FixedHeader_Cloned td { 
    background-color: white !important; 
} 
0

は同じ問題を抱えていました。

これは私の仕事:

"initComplete": function(settings, json) { 
    $('.dataTables_scrollBody thead tr').css({visibility:'collapse'}); 
} 

やCSS中を:

div.dataTables_scrollBody thead {   
    display: none; 
} 
関連する問題