Row Selection Not Returning a Row Id

Row Selection Not Returning a Row Id

uptempo777uptempo777 Posts: 5Questions: 4Answers: 0

I'm trying to implement multiple row selection in my table as documented here: http://www.datatables.net/examples/api/select_row.html

I'm using server-side processing so when I send back the JSON result, I include a column named DT_RowId that has the ID of the row I want to identify when selected. I checked the returned JSON and the DT_RowId is showing the Id I intended.

I added this function and it should alert the id (from DT_RowId) but it shows blank:

$('#border tbody').on('click', 'tr', function () {
alert('row clicked');
var id = this.id;
alert(id);
var index = $.inArray(id, selected);

        if ( index === -1 ) {
            selected.push( id );
        } else {
            selected.splice( index, 1 );
        }

        $(this).toggleClass('selected');
    } );

Is this a bug or does someone know what I am doing wrong?

Thanks,
Marvin

This discussion has been closed.