Button doesn't show using ajax and php

Button doesn't show using ajax and php

zamy1705zamy1705 Posts: 1Questions: 1Answers: 0

HI,

can somebody help i tried to add button to datatable but can't.
below is the script:

        var dataTable = $('#user_data').DataTable({
            "processing":true,
            "serverSide":true,
            "order":[],
            "ajax":{
                url:"fetch.php",
                type:"POST"
            },
            "columnDefs":[``
                {
                    "targets":[0,7],
                    "orderable":false,
                },
            ],
            "scrollX":true,
            "scrollY":false,
            "scrollCollapse":true,
            "fixedColumns": {leftColumns: 3},
            "buttons": [
                'copy', 'csv', 'excel', 'pdf', 'print'
            ]
    
        });

All script above are work with ajax php, except button.
Please help.

Thanks,
Zamy

Answers

  • kthorngrenkthorngren Posts: 21,132Questions: 26Answers: 4,918

    Did you add the required buttons JS and CSS libraries for these buttons?

        "buttons": [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
    

    You can use the Download Builder to get the proper set of libraries.

    Kevin

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    You also need to specify the B option in dom.

    Colin

This discussion has been closed.