troubleshooting Question

DATATABLE--: How to get row values when a cell is click

Avatar of SiemensSEN
SiemensSEN asked on
4 Comments2 Solutions8526 ViewsLast Modified:
  I have a datatable where first column is clickable icon,. When the icon is press I would like to get the values in that row. One of the column is hidden:

var oTable= $("#matchTable").dataTable(
               "bJQueryUI": true,     
               "bAutoWidth": false,
                "aoColumns": [         
                   { "sWidth": "2%" },         
                   { "sWidth": "30%" },         
                   { "sWidth": "5%"}, 
                   { "sWidth": "20%" ,"bVisible":    false},
                   { "sWidth": "43%"  }
              // "aaSorting": [[1, 'asc']]
               /* Disable initial sort */
                //"aaSorting": []
                "bSort": false

Open in new window

I am able to get the value by doing the following which get me the column value  but the click event is trigger when any cell in the row is pressed. I want it to only execute when the first cell is click

 oTable.$('tr').click( function ()
              var nTds = $('td', this); 
              var aPos = oTable.fnGetPosition( nTds[0]);
                var sData = oTable.fnGetData(this);
                path = sData[3]; // hidden column
                f = sData[1];

Open in new window

Also, the first cell in the row may not have a clickable icon. So, in this case the click event should not be fired
Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros