数据表未在正确的位置折叠第一列

时间:2019-03-07 16:39:30

标签: jquery datatables

我列的第一列在正确的位置没有折叠。在以下图像中,我显示了问题:

1. Image

2. Image

3. Image

4. Image

我的桌子看起来是这样的:

<div id="TestTable">
    <table id="example" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Extn.</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Extn.</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </tfoot>
    </table>
</div>

我的JS函数看起来像这样:

 $(document).ready(function () {
        $('#example').DataTable({
            serverSide: true,
            ajax: '../api/data/test',
            stateSave: false,
            responsive: true,
            "deferRender": true
        });
    });

有人知道如何纠正吗?

P.S。这是我从该页面获取的资源:

<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript" src="~/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="~/js/dataTables.responsive.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="~/css/navbar.css" />
<link rel="stylesheet" href="~/css/jquery.dataTables.min.css" />
<link rel="stylesheet" href="~/css/responsive.dataTables.min.css" />

0 个答案:

没有答案