fnRowCallback to replace row html and sorting
fnRowCallback to replace row html and sorting
I am trying to include contextual links below each row in a dataTable. The following example works, but sorting is broken. Is this the correct approach? How would I fix sorting? Is there a better way to provide contextual links for each row?
Anyone else tried to do something similar?? Thanks!
initialize datatable
[code]
$("#example").dataTable({
"bJQueryUI": true,
"bStateSave": true,
"bInfo": true,
"sPaginationType": "full_numbers",
"sAjaxSource": url,
"aoColumnDefs": [
{ "aTargets": [0], "bVisible": false },
{ "aTargets": [1], "sWidth": "90px" },
{ "aTargets": [3], "sWidth": "265px" },
{ "aTargets": [4], "sWidth": "125px" }
],
"fnRowCallback": processRow
});
function processRow(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
var html = '' +
'test1' +
'test2' +
'test3' +
'test4' +
'' +
'' +
'View Details | ' +
'Do Something | ' +
'Do Something' +
''
$(nRow).html(html);
return nRow;
});
[/code]
html
[code]
ID
one
two
three
four
[/code]
Anyone else tried to do something similar?? Thanks!
initialize datatable
[code]
$("#example").dataTable({
"bJQueryUI": true,
"bStateSave": true,
"bInfo": true,
"sPaginationType": "full_numbers",
"sAjaxSource": url,
"aoColumnDefs": [
{ "aTargets": [0], "bVisible": false },
{ "aTargets": [1], "sWidth": "90px" },
{ "aTargets": [3], "sWidth": "265px" },
{ "aTargets": [4], "sWidth": "125px" }
],
"fnRowCallback": processRow
});
function processRow(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
var html = '' +
'test1' +
'test2' +
'test3' +
'test4' +
'' +
'' +
'View Details | ' +
'Do Something | ' +
'Do Something' +
''
$(nRow).html(html);
return nRow;
});
[/code]
html
[code]
ID
one
two
three
four
[/code]
This discussion has been closed.