Sander
Sander

Reputation: 1401

Clickable row with datatables

How do I go with making a tr clickable while using datatables, though yet keeping the original browser's menu so they can middle-click for new tab or rightclick for the original browsers menu? (such as open in new tab, page, copy link, etc.) ?

I've tried Superlink, but this does not work in all browsers, I need it to be cross-browser (IE7 and newer!)

Any tips/tricks?

Upvotes: 3

Views: 4299

Answers (2)

joan16v
joan16v

Reputation: 5139

This works!

oTable = $('#RectifiedCount').dataTable( ....);

 $('#RectifiedCount tbody tr').live('click', function (event) {        
    var aData = oTable.fnGetData(this); // get datarow
    if (null != aData)  // null if we clicked on title row
    {
        //now aData[0] - 1st column(count_id), aData[1] -2nd, etc. 
        alert("equis");
    }
});

Upvotes: 0

Ricardo Binns
Ricardo Binns

Reputation: 3246

check this example from DataTables: select_row and see if helps you.

see the source Initialisation code

Upvotes: 3

Related Questions