dt.row(...).node(...) is null jquery.dataTable.responsive.js line:562

dt.row(...).node(...) is null jquery.dataTable.responsive.js line:562

larsonatorlarsonator Posts: 54Questions: 4Answers: 2
edited August 2014 in Free community support

I seem to get this error when a table is loaded, but there is no data to display.
This is inside the _resizeAuto function, there is a loop in there commented that it gets a clone of each row,
The each function roles into a function with and 'idx' parameter which seems to be an empty array when there is no data displayed on the table.

My understanding is that idx is supposed to represent a row number, so i fixed the issue by putting an number check.

dt.rows( { page: 'current' } ).indexes().each( function ( idx ) {
    if(idx instanceof Array)
        return;
    
    var clone = dt.row( idx ).node().cloneNode( true );
        
    if ( dt.columns( ':hidden' ).flatten().length ) {
        $(clone).append( dt.cells( idx, ':hidden' ).nodes().to$().clone() );
    }

    $(clone).appendTo( clonedBody );
} );

Replies

This discussion has been closed.