js提示Cannot read property 'style' of undefined

"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>


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值