Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82108

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

$
0
0

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
     });

Viewing all articles
Browse latest Browse all 82108

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>