Filtered results export to PDF

Filtered results export to PDF

Beli777Beli777 Posts: 4Questions: 2Answers: 0

Is there any way that I filter my table then filtered rows export in to pdf? All what PDF button is doing is that it's export all data in table. Sorry for my bad English. This is really urgent. Thanks

Answers

  • cdetermancdeterman Posts: 2Questions: 1Answers: 0
    edited September 2014

    I had a similar issue before. The tableTools 'copy_csv_xls_pdf.swf' should provide what you need. After filtering, you should be able to click the 'Save' button and have the PDF option. Make sure flash plugin is working for the browser.

    $('example').dataTable({ 
        "dom": 'T<"clear">lfrtip',
        "tableTools": {
            "sSwfPath": "//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/swf/copy_csv_xls_pdf.swf",
            "aButtons": [
            "copy",
            "print",
            {
                "sExtends":    "collection",
                "sButtonText": "Save",
                "aButtons":    ["csv", "xls", "pdf", "bShowAll": true]
            }
            ]
        }    
    });
    
  • Beli777Beli777 Posts: 4Questions: 2Answers: 0

    I implemented this but after i filter results it still export all rows in table. I need to export only filtered rows.

  • allanallan Posts: 61,787Questions: 1Answers: 10,115 Site admin

    You need to use the oSelectorOpts option to control if the filtered rows, or all rows are included.

    Allan

  • Beli777Beli777 Posts: 4Questions: 2Answers: 0

    I forgot to thank you guys, solved it.
    Is there any chance to design pdf since all i get is exported results?

  • allanallan Posts: 61,787Questions: 1Answers: 10,115 Site admin

    Is there any chance to design pdf since all i get is exported results?

    As in you want to add design elements to the PDF? You'd need to modify the code to do that. AlivePDF is the libraries used, and you'd need to refer to its API documentation to see how it can be done, but you can get some nice results.

    Allan

This discussion has been closed.