Footer totals not being exported to XLS

Footer totals not being exported to XLS

myqalanmyqalan Posts: 13Questions: 0Answers: 0
edited January 2010 in TableTools
Allan,

I've got the Table Tools plugin working, but I noticed that when the data is saved to an XLS file the column totals are not being sent with the rest of the data. Is there any way to force the export functionality to include these? The totals come from the fnFooterCallback function which does the calculations.

Replies

  • myqalanmyqalan Posts: 13Questions: 0Answers: 0
    edited January 2010
    Comment deleted....
  • allanallan Posts: 61,797Questions: 1Answers: 10,115 Site admin
    Hi myqalan,

    TableTools does not include the table footer in the example information. If you want to add it in you will need to modify fnGetDataTablesData in TableTools.js a little bit. I've added it to my to do list for the next release of TableTools as an optional feature.

    Regards,
    Allan
  • myqalanmyqalan Posts: 13Questions: 0Answers: 0
    edited January 2010
    Allan,

    I apologize, but I have been trying to get this to work for almost 8 hours. I have tried everything I can think of (its probably really simple) to get this to work. I have been trying to modify the fnGetDataTablesData function, but am at a loss. Is there any more of a pointer that you can give me.

    I'm not asking for you to write the code, but I honestly can't figure out how to force it to see the footer. Everything I have tried ends up with a blank file being saved (I guess that means I broke the function without breaking the JS).

    Thanks,

    Mike
  • allanallan Posts: 61,797Questions: 1Answers: 10,115 Site admin
    Hi Mike,

    I think this is one of the rare occasions where I will "just write the code" :-). Will save you a lot of time, and didn't take me long:

    [code]
    /* Add the footer */
    for ( i=0, iLen=_DTSettings.aoColumns.length ; i/g, "" );
    sData += fnBoundData( sLoopData, sBoundary, regex ) + sSeperator;
    }
    }
    sData = sData.slice( 0, sSeperator.length*-1 );
    [/code]
    That chuck will read the information from the table footer (live from the DOM, so your information in the footer put there by the callback will be correct), and add it to the output. It needs to go at the end of fnGetDataTablesData(), just before the return and "_sLastData = sData;" lines. If you have any problems, let me know.

    Regards,
    Allan
  • dobulet302dobulet302 Posts: 38Questions: 0Answers: 0
    Not sure if this worked for anyone, I added it TableTools.js right before
    [code]
    /* No pointers here - this is a string copy :-) */
    _sLastData = sData;
    return sData;
    [/code]

    It disabled my copy to clipboard and when opening the xls file it was empty.
  • prkarthikprkarthik Posts: 13Questions: 0Answers: 0
    edited May 2011
    hi,

    Ive added the code, but still ive the same issue...is there a solution...
  • sathishsathish Posts: 6Questions: 0Answers: 0
    Hey allan,
    I ve been facing the same problem...It would be very greatful if u juz hlp us in this issue...I need to xport the PDf along wth the footr calculatd by fnFooterCallback function...Thnax in advance
  • VacciphVacciph Posts: 9Questions: 1Answers: 0
    Hi,

    I think users can get the footer information printed if they use in place . It will not make any difference to the table UI and all the data will be exported to excel file.

    thanks,
    V
  • prkarthikprkarthik Posts: 13Questions: 0Answers: 0
    edited June 2011
    Hi Vacciph,


    Thanks for your suggestion..Even changing tfoot to thead i cant export the footer totals to any of the file format (.pdf,.xls,.csv)..

    Thanks.
  • sathishsathish Posts: 6Questions: 0Answers: 0
    Hi ,

    Thanx Vacciph.But changing to had no effect on it...Its not exporting the values calculated by the function footercallback...Pls help me with this...


    reg
    sathi
  • VacciphVacciph Posts: 9Questions: 1Answers: 0
    Can you please link me to the example.
  • prkarthikprkarthik Posts: 13Questions: 0Answers: 0
    edited June 2011
    Hi Vacciph,

    Below is my code ...


    $(document).ready( function () {
    $('table#tfilter').dataTable( {
    "iDisplayLength": 5000,

    "sDom": 'T&f&F',

    //*for calculating footer totals*//

    "fnFooterCallback": function (nRow, aasData, iStart, iEnd, aiDisplay ) {
    $($(nRow).children()).remove();
    if(iEnd > 0) { // if search result is empty do nothing
    for(var i=0;i
  • w1zardw1zard Posts: 6Questions: 0Answers: 0
    edited September 2011
    the creator has done a runner LOL. I have same problem with table tools and I am wanting someone to rewrite it with a bit more versatility. I hate it when people do a half-arsed job. 2.0.1 is just as weak as previous.
  • w1zardw1zard Posts: 6Questions: 0Answers: 0
    theres no such fucking option as bIncHiddenColumns
  • allanallan Posts: 61,797Questions: 1Answers: 10,115 Site admin
    By the creator I presume you mean me? I'm still here :-). The thread you are commenting on is from the start of 2010, when TableTools 1.x was available and bIncHiddenColumns was an option in that version of the library. In 2.x that has been replaced by the mColumns options ( http://datatables.net/extras/tabletools/button_options#mColumns ) which has considerably more flexibility.

    Also, please do not swear in this forum and show a little courtesy. If you have suggestions for how TableTools can be improved they are very welcome. Equally, TableTools is open source and you are feel to modify it to suit your needs.

    Thank you,
    Allan
  • earacheflearachefl Posts: 11Questions: 0Answers: 0
    Allan, should

    if ( _oSettings.bIncHiddenColumns === true || _DTSettings.aoColumns[i].bVisible )

    be changed to:
    if ( _oSettings.mColumns === 'visible' || _DTSettings.aoColumns[i].bVisible )
This discussion has been closed.