Responsible table and click

Responsible table and click

marcpiratmarcpirat Posts: 51Questions: 18Answers: 0

hi

I have an datable who is responsive

var specificationsTable = $('#specificationsTable').DataTable({
    "language": {
        "url": url
    },
    'dom': 'tp',
    responsive: {
        details: {
            display: $.fn.dataTable.Responsive.display.childRowImmediate,
            type: ''
        }
    },
    "bLengthChange": false, //hide 'show entries dropdown
    "paging": false,
    "searching": false,
    "info": false
});

I have this click event

$("#specificationsTable tbody").on('click', 'td', function(e) {

    var tr = $(this).closest('tr');

    //in case row is displaye on many row... (responsive)
    if ( $(tr).hasClass('child') ) {
        tr = $(tr).prev();  
    }


    //delete button
    if(specificationsTable.cell(this).index().column == specificationsTable.columns()[0].length-1){
       ...
    }

});

That work when all column are displayed on the same row... but otherwise, this line
specificationsTable.cell(this).index().column

is not working, I get

Cannot read property 'column' of undefined

thanks

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.