Uncaught TypeError: Cannot read property 'aDataSort' of undefined

前端 未结 5 1708
独厮守ぢ
独厮守ぢ 2020-12-18 01:00

i am working on pagination and i am using DataTables plugin , on some tables it\'s work but on some tables it gives error:

Uncaught TypeError: Cannot

5条回答
  •  甜味超标
    2020-12-18 01:25

    I faced same issue and later found a typing mistake in "targets" property under columnDefs. See below example,

    WRONG code below,

    {
     "name": "firstName",
     "target": [1],
     "visible": false
    }
    

    Correction - missed 's' in targets :(

    {
     "name": "firstName",
     "targets": [1],
     "visible": false
    }
    

    Looks like this error occurs when something causing columns not getting initialized. I checked that event 'preInit.dt' is not fired in this case.

    Hope this helps someone.

提交回复
热议问题