JQuery Datatables : Cannot read property 'aDataSort' of undefined

前端 未结 8 1972
日久生厌
日久生厌 2020-12-02 21:43

I created this fiddle to and it works well as per my requirements: Fiddle

However, when I use the same in my application I get an error in the browser console saying

相关标签:
8条回答
  • 2020-12-02 22:32

    I faced the same problem, the following changes solved my problem.

    $(document).ready(function() {
         $('.datatable').dataTable( {
                bSort: false,
                aoColumns: [ { sWidth: "45%" }, { sWidth: "45%" }, { sWidth: "10%", bSearchable: false, bSortable: false } ],
            "scrollY":        "200px",
            "scrollCollapse": true,
            "info":           true,
            "paging":         true
        } );
    } );
    

    the aoColumns array describes the width of each column and its sortable properties.

    Another thing to mention this error will also appear when you order by a column number that does not exist.

    0 讨论(0)
  • 2020-12-02 22:33

    Also had this issue, This array was out of range:

    order: [1, 'asc'],
    
    0 讨论(0)
提交回复
热议问题