[code]
//Assuming you are clicking on a cell ( or even a row)
$("#TransDetails td:nth-child(9)").live("click", function (){
// Get the row data
var id = oTable.fnGetData(this);
});
[/code]
fnGetPosition is not needed since you can just pass the td element to fnGetData. If you pass in a TH/TD cell then you get the cell's value. If you pass in a TR (this.parentNode in the above case) you get an array (or object) with the data for the row.
Replies
[code]
//Assuming you are clicking on a cell ( or even a row)
$("#TransDetails td:nth-child(9)").live("click", function (){
// Get the position
var aPos = oTable.fnGetPosition(this);
// Get the row data
var aData = oTable.fnGetData(aPos[0]);
// Get the cell data
var id = aData[0];
....
var startDate = aData[8];
});
[/code]
[code]
//Assuming you are clicking on a cell ( or even a row)
$("#TransDetails td:nth-child(9)").live("click", function (){
// Get the row data
var id = oTable.fnGetData(this);
});
[/code]
fnGetPosition is not needed since you can just pass the td element to fnGetData. If you pass in a TH/TD cell then you get the cell's value. If you pass in a TR (this.parentNode in the above case) you get an array (or object) with the data for the row.
Allan
How to highlight that row which is clicked?
As I say:
> If you pass in a TR (this.parentNode in the above case) you get an array (or object) with the data for the row.
So in the case above, you are passing in a TD element, so you get the data for the cell.
> How to highlight that row which is clicked?
http://datatables.net/release-datatables/examples/api/select_row.html
Allan