Cannot obtain DataTables API instance from a settings object
Cannot obtain DataTables API instance from a settings object
Hi,
I am trying to get an API instance from a settings object from within a renderer and only obtain error messages. The code I am using is exactly the same as the one on http://datatables.net/reference/type/DataTables.Settings.
In my case, that becomes
var table = new $.fn.dataTable( meta.settings );
This is throwing a TypeError from within JQuery
TypeError: this.each is not a function
(this[d]=Nb(d));this.each(function(){var d={},d=1<e?Lb(d,a,!0):a,g=0,j,i=this.ge...
jquery.....min.js (ligne 83, col. 16)
The only way I found to get the API is $(meta.settings.nTable).DataTable(), but I just read we should not rely on fields in the settings object.
I am using DataTables 1.10.7 with JQuery 1.11.2.
Since I switched to JQuery 1.11, I am getting all sorts of cryptic JQuery errors like the above, but they were previously caused by something wrong I was doing with my DataTables. But this time I am using a documented construct and still getting a JQuery error. Any idea?
Replies
To create a new API instance you should use
new $.fn.dataTable.Api( settings );
like in the page you link to.I'm not entirely sure what
new $.fn.dataTable()
will do! Nothing useful certainly.Allan