How to get from mData property a given cells value? I have the following code with the table initialization, I add dynamically cell values to my table specific column and I would like to define the data-id using the value of clicked rows hidden cell. If I alert (source
) I can see the comma separated data string. I would like to hole up the first value.
/* Table initialisation */
$(document).ready(function() {
var oTable = $('#example').dataTable( {
"aoColumnDefs": [ {
"aTargets": [ 15 ],
"mData": function ( source, type, val ) {
alert(source);
return "<a id='MyModal' data-id='" + source.my-id + "' href='#'>Edit</a> | <a href ='action.php?id='>Delete</a>";
}
} ]
} );
} );