How to use custom button to toggle between Datatable

How to use custom button to toggle between Datatable

Khalid TeliKhalid Teli Posts: 251Questions: 71Answers: 0

I am using the custom button to to display a datatable as shown below. How can I use the same button to toggle between this datatable.

For example when I click the button first time, it shows the table, how can I make it hide/destroy when clicking second time?
Thank you

   {
                    text: 'Invoice Details',
                    action: function ( e, dt, node, config ) {
                        $('#testfour').show();
                         var tabledetails = $('#testfour').DataTable( {


            "processing": true,
            "serverSide": true,

        "dom": 'lBrtip',
       "ajax":

         {
          url:"/xxx.php",
          type:'POST',
           "data": function ( d ) {

         var agreementID = abc;
          d.agreementID = agreementID;
          console.log(d.agreementID);

            }

    },



    "columns": [

            { data: "agreement_id_fk" },
.....
....

    ],

});


                }
            }

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.