Api is undefined

Api is undefined

LeonieLeonie Posts: 3Questions: 2Answers: 0
edited October 2014 in Free community support

When the table is built (Firefox version: 31.0), the table isn´t built with responsive behaviour and the console says:

TypeError: Api is undefined
Api.register( 'responsive()', function () {

In dataTable.responsive.js you find this code provoking the error:

/*
* API
*/
var Api = $.fn.dataTable.Api;

// Doesn't do anything - work around for a bug in DT... Not documented
Api.register( 'responsive()', function () {
return this;
} );

Api.register( 'responsive.recalc()', function ( rowIdx, intParse, virtual ) {
this.iterator( 'table', function ( ctx ) {
if ( ctx._responsive ) {
ctx._responsive._resizeAuto();
ctx._responsive._resize();
}
} );
} );

When I replace the var Api with the actual code $.fn.dataTable.Api, the responsive behaviour is working. It also works when I replace var Api with for example var DTApi. So it seems, that there is a name conflict, however I´m not using Api as a name. Has anybody else experienced the same issue? I can´t find the cause of this error.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Please link to a test case showing the error, as per the forum rules.

    My guess is you are using an old version of DataTables.

    Allan

  • LeonieLeonie Posts: 3Questions: 2Answers: 0

    I tried to provoke the error with a static html page, but i couldn´t reproduce it.

    I´m afraid I can´t provide a test case, because the project is still in build and there is sensitive data I can not publish.

    We use DataTables version 1.10.2 , but with the old naming scheme. the dataTables.responsive.js file is version 1.0.2-dev.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Okay thanks. I'm afraid I don't know what is causing the error in that case. I would need a test case to be able to offer any help.

    Allan

This discussion has been closed.