0

In the cvs,pdf,print plugin (tabletools) for datatable.js, when you click on print, for a brief moment an info box is displayed with the print info as well as using ESC to get back to the normal view. How can you control the info that is displayed in that info box, but more importantly how can I prevent if from fading out? Or perhaps at least changing the amount of time before it fades out?

Serj Sagan
  • 28,927
  • 17
  • 154
  • 183

1 Answers1

0

So my co-worker didn't want to take the time to post the answer here but I thought I'd share it in case someone else found the info useful:

Looks like there is no setting for the amount of time it stays open without changing the source code to TableTools.js If you look in that file at line 1779 you’ll see it is hard coded to 3 seconds.

Because the tabletools were being used throughout my application, I did not want to change the source code and affect all of the other uses. Instead I did this:

$("#myTable").dataTable({

        ...

        "oTableTools": {
            "sSwfPath": "SomePath/TableTools/media/swf/copy_csv_xls_pdf.swf",
            "aButtons": [

                ...    

                {
                    "sExtends": "print",
                    "sTitle": "",
                    "sInfo": "",
                    "sMessage": "",
                    "fnComplete": function ( nButton, oConfig, oFlash, sFlash ) {
                        openDialogWithMessage("Press the [Esc] key to return to the normal view.");

                        $('.ui-dialog,.ui-widget-overlay').addClass('doNotPrint');
                    }
                }
            ]
        }
    });

The openDialogWithMessage() is just a custom helper function to pop a jQuery UI Dialog Box. Then in my CSS file:

@media print {
    .doNotPrint, .doNotPrint * { display: none !important; }
}
Serj Sagan
  • 28,927
  • 17
  • 154
  • 183
  • `fnInfo` is only used twice, at line 1779 and in the `fnComplete` function, where the delay is set to 1500. So cannot see **any** reason for **not** changing the hardcoded value in this particular case. Or better, extend options with a value, like `iPrintStartMsgDelay : 1000` and refer to that value instead. – davidkonrad Oct 31 '14 at 11:55