DataTables: Cannot read property 'length' of undefined

前端 未结 11 1235
醉酒成梦
醉酒成梦 2020-12-13 05:15

I understand this a popular issue, and I have read all the similar questions here on Stack Overflow and other sites (including the datatables website).

To clarify, I

11条回答
  •  余生分开走
    2020-12-13 05:59

    If you are using ajax as a function remember it expects JSON data to be returned to it, with the parameters set.

    $('#example').dataTable({
        "ajax" : function (data, callback, settings) {
            callback({
                data: [...],
                recordsTotal: 40,
                recordsFiltered: 40}
                ));
        }
    })
    

提交回复
热议问题