DataTables-2.03 Select-2.0.0 nodes is not a function - BUG???

DataTables-2.03 Select-2.0.0 nodes is not a function - BUG???

paul@dmcreative.compaul@dmcreative.com Posts: 27Questions: 5Answers: 0

Error message generated in Chrome
Uncaught TypeError: type.nodes is not a function:

Upgraded to Datatables 2.0.3 and Select 2.0.0 now the following code that previously worked generates the error message.

resident_table.on( 'select', function ( e, dt, type, indexes ) {
    resident_table[type](indexes).nodes().to$().removeClass('warn');
};

The example on the page: https://datatables.net/reference/event/select
Generates the same error.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Answer ✓

    It isn't a function - the fact that it worked before was a bug! type is one of row, cell or column, and there is no row().nodes() method. It is either rows().nodes() or row().node() - note the pluralisation.

    The change is easy though - just stick an s on the end of types: https://live.datatables.net/jonapudu/1/edit .

    var resident_table = new DataTable('#example', {
      select: true
    });
    
    resident_table.on( 'select', function ( e, dt, type, indexes ) {
        resident_table[type + 's'](indexes).nodes().to$().removeClass('warn');
    });
    

    Allan

  • paul@dmcreative.compaul@dmcreative.com Posts: 27Questions: 5Answers: 0

    Alan,
    Problem resolved
    Thanks Paul

Sign In or Register to comment.