Trouble customizing printout.

Trouble customizing printout.

TomSAbnerTomSAbner Posts: 7Questions: 1Answers: 0
edited January 15 in Free community support

Link to test case:
https://emerg911.com/usersc/WaterCompRep.php
user ADTT pass Emerg911

Debugger code (debug.datatables.net):
https://debug.datatables.net/bookmarklet/DT_Debug.js?rand=1705291804990 debugger eval code:13:22

Error messages shown:
no error message

Description of problem:
it creates its own title, or header for the report. looks bad, would like to give it two custom lines, and have it centered out. here is my initialization,,, when i tried to add the custom text info it killed the page from loading,,

$(document).ready(function() {
    // Initialize DataTable with Buttons extension
    var table1 = $('#report1-summary').DataTable({
        "paging": true,
        "lengthChange": false,
        "searching": true,
        "ordering": true,
        "info": true,
        "autoWidth": false,
        "responsive": true,
        "buttons": [
            'print',
            'copy',
            'excel',
            'pdf',
            'colvis'  // Add the print button
        ]
        // Add any additional options or configurations as needed
    });

i am sorry if i missed anything in the forums and thanks in advance for any information anyone can share,

this is a small project for 4 small volunteer fire departments. 3 of which i am a volunteer firefighter at.

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has accepted answers - jump to:

Answers

  • TomSAbnerTomSAbner Posts: 7Questions: 1Answers: 0

    code,,, which i miss coppied,,, eresit

    also,, corrected the border-collapse setting issue,,,

  • allanallan Posts: 63,445Questions: 1Answers: 10,465 Site admin

    This is what the print preview looks like for me:

    Do you want to loose the first line? If so, use:

    {
      extend: 'print',
      title: ''
    }
    

    Allan

  • TomSAbnerTomSAbner Posts: 7Questions: 1Answers: 0

    i am making small progress,,, i got a message to print,,, so maybe now,, i can get title to change,,, is there anyway to get them to center over the report, or just left justify?

  • allanallan Posts: 63,445Questions: 1Answers: 10,465 Site admin
    Answer ✓

    You can use print specific CSS - see this post for more details on how to use a CSS media query for print.

    Allan

  • TomSAbnerTomSAbner Posts: 7Questions: 1Answers: 0

    Thanks,,, I appreciate your time and answer.. That is close to what i was trying to get it to print but, i had missed something,... and with these css print styles,,, do i work those into the the css of the page with the table, or into the into the script that initializes DataTables?

    Thanks
    Tommy

  • allanallan Posts: 63,445Questions: 1Answers: 10,465 Site admin
    Answer ✓

    Buttons will include the stylesheets from your host page in the print output, so if you just include the print specific styling in a stylesheet on that page, it should get picked up.

    Allan

  • TomSAbnerTomSAbner Posts: 7Questions: 1Answers: 0

    Hey Allan, thank you so much for the information,,, this will help me get things cleaned up and presentable,,

    Regards
    Tommy

Sign In or Register to comment.