Table tools wont work with fnRowCallback

Table tools wont work with fnRowCallback

chandanbokarochandanbokaro Posts: 4Questions: 0Answers: 0
edited February 2013 in TableTools
I use fnRowCallback to calculate the serial number of the row. Just for display purpose.
[code]"fnRowCallback" : function(nRow, aData, iDisplayIndex){
var oSettings = oAllLinksTable.fnSettings();
$("td:first", nRow).html(oSettings._iDisplayStart+iDisplayIndex +1);
return nRow;[/code]

Now when i export the file pdf/excel/csv or copy to clipboard the calculated row is not exported or present in clipboard.

How to proceed with this.. Any Idea !


[code]
oAllLinksTable= $("#companies1").dataTable(
{
"sAjaxSource" : "/DTS/MultiskillServlet?screenCode=MasterData",
"aaSorting" : [],
"bDestroy" : true,
"bJQueryUI" : true,
"bStateSave": false,
"bRetrieve" : false,
"bProcessing" : true,
"iDisplayLength": 10,
"oLanguage": {
"sSearch": "Search all columns:"
},
"sPaginationType" : "full_numbers",
"sDom": 'T<"clear">lfrtip',
"fnRowCallback" : function(nRow, aData, iDisplayIndex){
var oSettings = oAllLinksTable.fnSettings();
$("td:first", nRow).html(oSettings._iDisplayStart+iDisplayIndex +1);
return nRow;
},
"aoColumns" :
[
{"mData":null},
{ "mData" : "stno",
"mRender": function ( o,val,data ) {
if(data.last_payment != '-')
return ''+o+'';
else
return o;

}},
{ "mData" : "name"},
{ "mData" : "grade"},
{ "mData" : "deptt"},
{ "mData" : "skill_accq"},
{ "mData" : "hrd_comp_date"},
{ "mData" : "util_end_date"},
{ "mData" : "last_payment"}

],
"oTableTools": {
"aButtons": [
"copy",
"csv",
"xls",
"pdf",
"print"
]
}
});

[/code]

Replies

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Same reason as this: http://datatables.net/faqs#append . You need to use the API - specifically fnUpdate without a redraw (otherwise you get an infinite loop).

    Allan
  • ibramibram Posts: 1Questions: 0Answers: 0
    try

    "bDestroy" : false,
  • chandanbokarochandanbokaro Posts: 4Questions: 0Answers: 0
    Thanks.. exactly what i wanted
This discussion has been closed.