I want to use Print ,exportToPdf, button with Column Filter in Datatable .

I want to use Print ,exportToPdf, button with Column Filter in Datatable .

AsifkkhanAsifkkhan Posts: 11Questions: 3Answers: 0
edited June 2019 in Free community support

Hi, I want to use Print ,exportToPdf, button with Column Filter in Datatable .

the problem is code run fine but not showing button.
here is my code.

<script>

    $(document).ready(function () {
        // Setup - add a text input to each footer cell
        $('#<%= GridView1.ClientID %> thead tr').clone(true).appendTo('#<%= GridView1.ClientID %> thead');

        $('#<%= GridView1.ClientID %> thead tr:eq(1) th').each(function (i) {
            var title = $(this).text();
            $(this).html('<input type="text" placeholder="Search ' + title + '" />');

            $('input', this).on('keyup change', function () {
                if (table.column(i).search() !== this.value) {
                    table
                    .column(i)
                    .search(this.value)
                    .draw();
                }

            });


        });

        var table = $('#<%= GridView1.ClientID %>').DataTable({
            orderCellsTop: true,
            fixedHeader: true,
 dom: 'Bfrtip',
                buttons: [
            'print',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'

        ]



        });
    });                
</script>

EDIT: Updated to format code using Markdown.

Replies

  • kthorngrenkthorngren Posts: 21,147Questions: 26Answers: 4,918
    edited June 2019

    Please format your code using Markdown.

    the problem is code run fine but not showing button.

    Likely you are missing some or all of the Buttons JS and/or CSS files. You can use the Download Builder to generate the proper set of includes.

    If this doesn't help then we would need a link to your page or a test case replicating the issue. Without seeing what you are doing it would be difficult to troubleshoot.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.