How can i make a table with export filters and export buttons?

How can i make a table with export filters and export buttons?

luisvq24luisvq24 Posts: 2Questions: 1Answers: 0

I have a table with filters but when I add the buttons to export, the buttons do not appear

Answers

  • luisvq24luisvq24 Posts: 2Questions: 1Answers: 0

    this is the code he used

        var table = $('#table_id').DataTable({
            orderCellsTop: true,
            fixedHeader: true,
            "scrollY": 460,
            "scrollX": true,
            dom: 'Bfrtip',
            buttons: [
                'copy', 'csv', 'excel', 'pdf', 'print'
            ],
            "dom": 'Bfrtip',
            "buttons": [
                'copyHtml5',
                'excelHtml5',
                'csvHtml5',
            ],
        });
    
  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    The first problem is you are defining the buttons twice, although the second should be the one used.

    If the buttons aren't showing then I would start by making sure you are loading the buttons JS and CSS and associated dependancies like the HTML Export JS. You can generate the proper files using the Download Builder. Also these docs explain what is needed:
    https://datatables.net/extensions/buttons/

    The above code looks like it should work, as long as you remove one of the buttons definitions. If you continue to have difficulties we will need to see your page to help troubleshoot. Please post a link to your page or a test case replicating the issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.