SiemensSEN
asked on
DATATABLE--: How to get row values when a cell is click
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:
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
Also, the first cell in the row may not have a clickable icon. So, in this case the click event should not be fired
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
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You're welcome.
ASKER