js提示Cannot read property 'style' of undefined

来源:互联网 发布:大数据与网络安全论文 编辑:程序博客网 时间:2024/06/05 00:07

"order": [[6, "asc"]],
改为

"order": [[0, "asc"]],

原因,只有3列,我选了第6列进行排序...

所以有一种越界的感觉,因此报错了


<div class="box-body">    <table class="table table-bordered table-striped" id="mytable" role="grid" aria-describedby="user" style="width: 100%;">        <thead>        <tr>            <th>名字</th>            <th>年龄</th>            <th>性别</th>        </tr>        </thead>    </table></div>



<script>    var table;    $(function () {        table = $('#mytable').DataTable({            "sScrollY": $(this).height() -280,            "serverSide": true,            "processing": true,            "paging": true,            "lengthChange": false,            "searching": false,            "ordering": false,            "info": true,            "autoWidth": true,            "order": [[0, "asc"]],//按照第几列排序            "pageLength": 10,            "bLengthChange": true,            "oLanguage": lang,            "ajax": {                "url": "${CONTEXT_PATH}/admin/essay/voteList",                "type": "POST",                "dataSrc": "data",                "data": function (d) {                    d.extra_search = $("#form").serialize();                }            },             "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 5 ] }],            "columns": [                {"data": "name"},                {"data": "age"},                {"data": "sex"}            ]        });    });</script>


阅读全文
0 0
原创粉丝点击