Uncaught TypeError: Cannot read property 'className' of undefined

后端 未结 7 1752
春和景丽
春和景丽 2020-12-31 00:14

The following error is being thrown in Google Chrome\'s developers tools:

Uncaught TypeError: Cannot read property \'className\' of undefined

7条回答
  •  抹茶落季
    2020-12-31 00:35

    In my specific case, I had the aTargets properties set with array indices outside the bounds for my elements.

    $('.datatable').dataTable({
      aoColumnDefs: [
        {
          bSortable: false,
          aTargets: [0, 6]
        }
      ],
      aaSorting: []
    });
    

    This set that there were 7 td columns, but there were only 6. Changing it to the following corrected it:

    $('.datatable').dataTable({
      aoColumnDefs: [
        {
          bSortable: false,
          aTargets: [0, 5]
        }
      ],
      aaSorting: []
    });
    

提交回复
热议问题