table.columns is not a function in datatable.js

前端 未结 8 1628
鱼传尺愫
鱼传尺愫 2021-02-01 13:12



        
8条回答
  •  独厮守ぢ
    2021-02-01 13:26

    I know this is a 2 year old post, but it is still on top search results on Google when searching for this problem. So I had the same problem but I fixed it without changing code. The problem by my code was that I used a older jQuery or Datatables version (not sure which one caused trouble) so I generatet a new link on the Datatables site:

    https://datatables.net/download/index

    with including jQuery2.x and the rest left on default:

    Therefore you have to remove your included jQuery Library and the Datatables Library, because both of them is included in this link. After that everything work fine without any error...

    So I figured out why the problem is on the older versions: In the older versions of Datatables the datatable was called with the function:

    $('#dt1').dataTable();
    

    and so and old version of the table was given back, which NOT included the function .columns() so the calling new function: $('#dt1').DataTable(); should fix it (as Rizzim already said) but to do this you have to update your datatables, so the function is included...

    (Sorry for bad english)

提交回复
热议问题