troubleshooting Question

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

Avatar of SiemensSEN
SiemensSEN asked on
JavaScriptjQuery
4 Comments1 Solution8526 ViewsLast Modified:
Hello,
  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
                
           }


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];
                 alert(fle+"/"+path+f);
            });

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 the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
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 1 Answer 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