Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery dataTables 3x3列,不带标题_Jquery_Datatables - Fatal编程技术网

jQuery dataTables 3x3列,不带标题

jQuery dataTables 3x3列,不带标题,jquery,datatables,Jquery,Datatables,我正在使用显示数据列表,并将其显示到3x3网格中。我不想使用标题,因为它不是必需的 以下是我的javascript: $('table.grid_view').dataTable({ "oLanguage": { "sSearch": "<p style='margin:5px 0;'>Search:</p>" }, "bLengthChange": false, "bFilter": true, "bSort":

我正在使用显示数据列表,并将其显示到3x3网格中。我不想使用标题,因为它不是必需的

以下是我的javascript:

$('table.grid_view').dataTable({
    "oLanguage": {
        "sSearch": "<p style='margin:5px 0;'>Search:</p>"
    },
    "bLengthChange": false,
    "bFilter": true,
    "bSort": false,
    "bAutoWidth": false,
    "iDisplayLength": 3,
    "sPaginationType": "full_numbers",
    "aoColumns": [null,null,null]
});
我花了一些时间修改表或javascript,使其不会发出任何警报,我也搜索了任何可能的解决方案,但它们似乎都不起作用,请帮助我将您的所有tr保留在一边


为每个块创建一个div,在每行的单个td处放置一个3块,并用css隐藏标题,如下所示

<table id="display_table">
<thead>
<th>Anything</th>
</thead>
<tbody>
<tr>
 <td><div class="block">Contents</div>
    <div class="block">Contents</div>
    <div class="block">Contents</div>
 </td>
</tr>
<tr>
 <td><div class="block">Contents</div>
    <div class="block">Contents</div>
    <div class="block">Contents</div>
 </td>
</tr>
<tr>
 <td><div class="block">Contents</div>
    <div class="block">Contents</div>
    <div class="block">Contents</div>
 </td>
</tr>
</tbody>
</table>

<style>
.dataTables_wrapper table thead{
    display:none;}
</style>

现在,据我所知,datatable初始化的代码没有thead部分datatable无法工作…你可以做的是…编写thead部分,但让它对用户不可见..通过隐藏headerone,表结构中的更多内容是错误的..那就是你有一个tr之后..这也会在datatable验证中失败我尝试了这个,但警报仍然会弹出,我也尝试添加一个thead部分,但问题仍然存在。还有其他建议吗?谢谢如果不是这样的话,那么你的表中缺少了一个td…你能发布最终呈现的html吗..只有表的一部分..或者更好,如果你在Datatable论坛上发布这个问题,那么,我想我应该在Datatable的论坛上发布这个,非常感谢Vivek
<thead>
    <tr>
        <th class="sorting_disabled" rowspan="1" colspan="1"></th>
        <th class="sorting_disabled" rowspan="1" colspan="1"></th>
        <th class="sorting_disabled" rowspan="1" colspan="1"></th>
    </tr>
</thead>
<div id='grid_wrap'>
    <table class="grid_view">
        <tbody>
        <?php
        if (!empty($grid_datas)){
            $i = 1;
            $index = 0;
            foreach ($grid_datas as $grid_data){
                $index++;
                if($i == 0){ echo '<tr>';}
                if($index == count($grid_datas)){$colspan = $index % 3;}
                else{$colspan = 1;}
            ?>
                <td>
                    <?php echo $grid_data['the_data'];?>
                </td>
            <?php
                if($index == count($grid_datas) || $index % 3 == 0){
                    echo '</tr>';
                    $i = 0;
                }else{$i++;}
            }?>

        <?php }else{?>
        <tr>
            <td>No data Found</td>
        </tr>
        <?php }?>
      </tbody>
    </table>
</div>
<table id="display_table">
<thead>
<th>Anything</th>
</thead>
<tbody>
<tr>
 <td><div class="block">Contents</div>
    <div class="block">Contents</div>
    <div class="block">Contents</div>
 </td>
</tr>
<tr>
 <td><div class="block">Contents</div>
    <div class="block">Contents</div>
    <div class="block">Contents</div>
 </td>
</tr>
<tr>
 <td><div class="block">Contents</div>
    <div class="block">Contents</div>
    <div class="block">Contents</div>
 </td>
</tr>
</tbody>
</table>

<style>
.dataTables_wrapper table thead{
    display:none;}
</style>