PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Sep 25, 2017 10:14 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Nov 02, 2016 3:21 pm 
Offline
Forum Newbie

Joined: Sun Sep 11, 2016 9:36 pm
Posts: 8
I have a Datatables using HTML (DOM) sourced data. I have 30 columns in my table. I have a print button, button when I print about 6 columns do not fit. Also, some cells have background colors. How can I customize this Print function so that I can print 11 by 17 preserving the background colors of the cells?
My script for Datatables:

Syntax: [ Download ] [ Hide ]
<script>
    $(document).ready(function() {
        $('#myTable').DataTable( {
            "order": [[0, "asc"]],

            "paging": false,
            "scrollCollapse": true,

            "columnDefs": [{
                "targets": [0],
                "visible": false,
                "searchable": false
            }],

            dom: 'Bfrtip',
            buttons:
            [

           {
                    extend: 'print',
                    text: 'Print',

                }
                ]

        } );
    } );
</script>


Top
 Profile  
 
PostPosted: Fri Nov 04, 2016 2:35 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13427
Location: New York, NY, US
Printing HTML is not very dependable. Many print drivers will not print background colors. If you know the specific printer, then you may be able to get it to work. Also, you may need to instruct the user to print in landscape.

An alternative would be to generate a PDF of the table and have the user print that.

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group