How To add Edit And Delete Button to the Dynamically Created Column to each rows

How To add Edit And Delete Button to the Dynamically Created Column to each rows

bhushan_dhokbhushan_dhok Posts: 1Questions: 1Answers: 0
edited January 15 in Free community support

I am Having JSON object from which i am creating Dynamic Columns. At 5th position i am having ID which i want to pass to Server. How do i achieve it on click of specific button

 var jsonData=data[key[0]];
 var column=data[key[1]];

 $('#example').DataTable({
          data: jsonData,
          columnDefs: [
                {
                    targets: 5,
                    render: function(data, type, full, meta){
                       if(type === 'display'){
                          data = 
                              '<button class="btn-edit" type="button">Edit</button>'
                              + '<button class="btn-delete" type="button">Delet</button>';
                       }

                       return data;
                    }
                }       
            ],
         columns: column
     });
Sign In or Register to comment.