2016-06-20 4 views
0

私のPHPコードがデータテーブルで垂直に設定するにはどうすればいいですか?

ここ
while($row = mysql_fetch_array($run_query)){ 
    $name = $row['first_name']; 
    $name_string = "<a edit_id='name_".trim($name)."' href='#' onClick=\"click_today('{$name}');\" data-toggle='modal' data-target='#myModal'>{$name}</a>"; 

    //onClick=\"click_today('{$name}');\" 
    $result_array[] = array($row['id'], $name_string, $row['last_name'], $row['job_title'], $row['salary'],"-","-","-"); 
} 
echo json_encode($result_array); 

をacutually私の結果は、私はjqueryのデータテーブル、

HTMLコード

<table id="result_table" class="display table table-bordered" cellspacing="0" width="100%"> 
       <thead> 
        <tr> 
         <th>#</th> 
         <th>Username</th> 
         <th>Activation Status</th> 
         <th>Recent Login</th> 
         <th>Total No. of login</th> 
         <th>Avg No. of login/day</th> 
         <th>Total No. of Exports</th> 
         <th>Total No. of access</th> 
        </tr> 
       </thead> 
       <tfoot> 
        <tr> 
         <th>#</th> 
         <th>Username</th> 
         <th>Activation Status</th> 
         <th>Recent Login</th> 
         <th>Total No. of login</th> 
         <th>Avg No. of login/day</th> 
         <th>Total No. of Exports</th> 
         <th>Total No. of access</th> 
        </tr> 
       </tfoot> 
      </table> 

を使用していると私はJSONデータ型にAJAX呼び出しのテーブルデータをロードする必要があります(サンプル出力) enter image description here

しかし、私は、テーブル enter image description here

私は常に水平thead要素を使用していますjqueryのデータテーブル内の垂直方向のヘッダーを実装する方法を知りませんが、今、私は

答えて

0

ことができるために必要なPLSのウルの提案やソリューションを垂直ヘッダを共有する必要がありますこの種の出力をサーバー側[PHP]から にすると、datatableを割り当てることができます。私もこの問題に直面していましたが、サーバー側から の道を開いて、別の方法でも期待通りのフォーマットを変更しています。PIVOTテーブル データベースを使用

関連する問題