I have a datatable that is created with Ajax. However, I do not want all the fields to be displayed and thus I set bVisible to false on the not-so-important field.
I would recommend something like this:
var data = [];
$.ajax({url:"../DataQueries/FetchAllSubjectsForBrowse.asp",success:function(result){
data=result;
}});
var i=0;
data.forEach(function(d) {d.index=i++;});
$('#example').dataTable( {
"bProcessing": true,
"aaData":data,
"aoColumns": [
/*index*/
/* Subject Name */ null,
/* Address */ null,
/* LinkedWithCompany */ { "bVisible": false},
/* Work Tel */ null
]
} );
Then in your click handler get the index and then access the record in your original data array
$('#example tbody tr').live('click', function () {
var sTitle;
var nTds = $('td', this);
var index = $(nTds[0]).text();
var record = data[i];
});
This is just a starting point, but I hope you get the idea.