two rows of th save to excel

two rows of th save to excel

lihailihai Posts: 15Questions: 0Answers: 0
edited December 2012 in General
My table's thead has two rows of th:

XY
Y1

Replies

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Currently there is no built in way to do this in TableTools. You'd need to modify the TableTools source to include the extra row in the header. TableTools currently only reads the content from the 'sorting' header cells.

    Allan
  • lihailihai Posts: 15Questions: 0Answers: 0
    Thank you allan.I found the code in the TableTools.The function _fnGetDataTablesData is to control save the content of the table.The head's code:
    //line 1505
    /*
    * Header
    */
    if ( oConfig.bHeader )
    {
    aRow = [];

    for ( i=0, iLen=dt.aoColumns.length ; i/g, "" ).replace(/^\s+|\s+$/g,"");
    sLoopData = this._fnHtmlDecode( sLoopData );

    aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
    }
    }

    aData.push( aRow.join(oConfig.sFieldSeperator) );
    }
    But I have no idea how to modify it.I just learn js no longer time.I only can read something from it.Could you help me.
  • psspss Posts: 19Questions: 0Answers: 0
    There is an alternative solution to this, where replacing colspan/rowspan with empty s can export all rows of headers to csv/excel, as I explained in the post below:

    http://stackoverflow.com/questions/7660683/tabletools-only-exporting-single-header-row/14813085#14813085

    Although, headers are not merged in csv/excel, so I'm too looking forward if a better solution can be there.
  • lihailihai Posts: 15Questions: 0Answers: 0
    hello pss.I try the solution.But it doesn't work well. I also try the other solutions in http://stackoverflow.com/questions/7660683/tabletools-only-exporting-single-header-row.The same,they doesn't work well.If someone who has a good solution to the problem.Thank you so much.Tel me.....
This discussion has been closed.