【问题标题】:How to set thead in vertical in datatable?如何在数据表中垂直设置thead?
【发布时间】:2016-10-21 07:32:16
【问题描述】:

我用过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>

我必须在我的 PHP 代码中以 JSON 数据类型在 ajax 调用中加载表数据

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);

实际上我的结果是(示例输出)

但我想在数据表中跟随图像输出

我不知道如何在 jquery 数据表中实现垂直标题我一直使用水平标题但现在我需要垂直标题,因为需要请分享你的建议或解决方案

【问题讨论】:

    标签: php jquery html datatables


    【解决方案1】:

    有可能只从服务器端[php]进行这种输出 分配数据表。我也遇到过这个问题,但我从服务器端让路 还有另一种方法是您使用 PIVOT Table 更改您的预期格式 使用数据库

    【讨论】:

      猜你喜欢
      • 2021-05-11
      • 2021-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多