PDF printing problem

PDF printing problem

spudwaspudwa Posts: 8Questions: 0Answers: 0

I have a table with a hidden column. It is setup using aoColumns

"aoColumns": [ 
           /* image */        null,
            /* table */          null,
            /* id */               null,
            /* details */           { "bSearchable": false, bVisible: false }
        ], 

I also need to use mColumns as my first column is an image and I want to ignore it in PDF etc
``` "mColumns": [1, 2, 3]
But when I create a PDF using Tabletools the hidden last column prints as a column which is a single character wide. I've tried adding an sWidth attribute to aoColumns but it doesn't work.
Any suggestions?

Replies

  • DaharkDahark Posts: 28Questions: 1Answers: 0

    Hello spudwa,

    so if you print a PDF you only want the 2nd and 3rd Column to be printed?

    What does your complete TableTools Setup look like?

    Regards

  • spudwaspudwa Posts: 8Questions: 0Answers: 0
    var oTable = $("#auditLog").DataTable({
            "sDom": 'T<"clear">lfrtip',
            "aaSorting": [[1, 'desc']],
            "aoColumnDefs": [
                { "bSortable": false, "aTargets": [ 0 ] }
            ],
            "aoColumns": [ 
                /* expand */            null,
                /* date */              null,
                /* user */              null,
                /* table */             null,
                /* id */                null,
                /* operation */         null,
                /* description */       null,
                /* details */           { "bSearchable": false, bVisible: false }
            ], 
            "oTableTools": {
                "sSwfPath": "/swf/copy_csv_xls_pdf.swf",
                "sRowSelect": "multi",
                "aButtons": [
                    "select_all", "select_none",
                    {
                        "sExtends": "collection",
                        "sButtonText": "Save",
                        "aButtons": [
                            { "sExtends": "csv", "bSelectedOnly": true, "mColumns": [1, 2, 3, 4, 5, 6, 7] },
                            { "sExtends": "xls", "bSelectedOnly": true, "mColumns": [1, 2, 3, 4, 5, 6, 7] },
                            { "sExtends": "pdf", "bSelectedOnly": true, "mColumns": [1, 2, 3, 4, 5, 6, 7] }
                        ]
                    }
                ]
            }
        });
    
  • DaharkDahark Posts: 28Questions: 1Answers: 0
    edited June 2014

    Hey,

    maybe you should change:

    "mColumns": [1, 2, 3, 4, 5, 6, 7]
    

    to

    "mColumns": [1, 2, 3, 4, 5, 6]
    
  • spudwaspudwa Posts: 8Questions: 0Answers: 0

    But I need column 7 included in the PDF :-(
    The 7th 'column' actually is displayed as a second line using the following code. Hence the column called expand which shows a graphic of a + button. See my previous post on displaying drill down data

    $('#auditLog tbody').on('click', 'td', function(event) {
            var tr = $(this).parents('tr');
    
            if (!tr)
                return;
    
            if (!tr.hasClass('main-row')) {
                event.stopImmediatePropagation();
                return;
            }
    
            var row = oTable.row(tr);
            
            if (row.child.isShown()) {
                // This row is already open - close it
                row.child.hide();
                tr.removeClass('shown');
                tr.find("img").attr("src", '../../Images/details_open.png');
            }
            else {
                // Open this row
                row.child(row.data()[row.data().length - 1]).show();
                tr.addClass('shown');
                tr.find("img").attr("src", '../../Images/details_close.png');
            }
        });
    
This discussion has been closed.