DataTable中的响应表

问题描述 投票:0回答:1

我的页面看起来像这样:

我想在页面太小时添加scrollX所以我必须添加行scrollX: true

当我添加页面时看起来像这样:

DataPicker位于行后面,列的行不在同一行,而是scrollX工作(看图片)。当我在输入和ajax加载数据中写入列的行工作正常但数据删除仍然不起作用。我该怎么修呢?

代码_table.blade.php

<table class="table table-striped table-bordered" id="policies-table" style="width: 100%;">
    <thead>
        <tr>
            <th>Numer polisy</th>
            <th>Produkt</th>
            <th>Data wystawienia</th>
            <th>Wartość</th>
            <th>Składka</th>
            <th>Wystawiający</th>
            <th>Akcje</th>
        </tr>
    </thead>
</table>

Ajax加载:

$('#policies-table').DataTable({
    ajax: {url:"url",
    type: "POST",
    'headers': {'X-CSRF-TOKEN': '{{ csrf_token() }}'}},
    processing: true,
    serverSide: true,
    autoWidth: true,
    scrollX: true,
    scrollCollapse: true,
    jQueryUI: true,
    order: [[ 2, "desc" ]],
    ........
});
php css laravel datatables
1个回答
0
投票

试试这个$('#policies-table').DataTable({responsive: true} );

或者如果您使用bootstrap,您可以尝试这个

<div class='table-responsive'>
    <table class='your classes'>
    </table>
</div>
© www.soinside.com 2019 - 2024. All rights reserved.