实现DataTable js scrollx问题

时间:2016-03-08 06:52:15

标签: javascript jquery datatables materialize

我一直在使用Materialize DataTable JS这里是我的html代码

<table id="data-table-simple" class="responsive-table display highlight" cellspacing="0">
                        <thead>
                            <tr>
                                <th>Full Name</th>
                                <th>Email</th>
                                <th>Specialty</th>
                                <th>Gender</th>
                                <th>Start date</th>
                                <th>Status</th>
                                <th>Publish</th>
                                <th>Edit Field</th>
                                <th>Remove User</th>
                            </tr>
                        </thead>

                        <tfoot>
                            <tr>
                                <th>Full Name</th>
                                <th>Email</th>
                                <th>Specialty</th>
                                <th>Gender</th>
                                <th>Start date</th>
                                <th>Status</th>
                                <th>Publish</th>
                                <th>Edit Field</th>
                                <th>Remove User</th>
                            </tr>
                        </tfoot>

                        <tbody>
                            <tr>
                                <td>Juan Dela Cruz</td>
                                <td>juandelacruz@email.com</td>
                                <td>Medical</td>
                                <td>Male</td>
                                <td>2016/01/01</td>
                                <td><center><span class="task-cat cyan">Active</span></center></td>
                                <td>
                                    <center>
                                    <a class="btn-flat waves-effect green white-text"><i class="mdi-file-cloud-done left"></i>Published</a>
                                    </center>
                                </td>
                                <td>
                                    <center>
                                        <a class="modal-trigger btn-floating btn-flat waves-effect waves-light blue accent-4 white-text" href="#edit"><i class="mdi-editor-mode-edit"></i></a>
                                    </center>
                                </td>
                                <td>
                                    <center>
                                        <a class="btn-floating btn-flat waves-effect waves-light red accent-4 white-text"><i class="mdi-action-delete"></i></a>
                                    </center>
                                </td>
                            </tr>
                        </tbody>

                    </table>

这是Javascript代码

<script type="text/javascript">
//$(document).ready(function(){
$('#data-table-simple').dataTable({
    'scrollX': true
});
//});

我已经搜索了如何在DataTable中启用水平滚动 但水平滚动不起作用可能是因为我正在使用物化数据表?我需要你的帮助 。感谢

0 个答案:

没有答案