I want to put check box to the data table ,and the output is coming from Json array ,and displaying these array elements in html table using javascript.
and I want to add a checkbox to each and every row so that it can be easy to edit,delete.
HTML Code is:
<table id="example1" class="table table-bordered table-striped num-right-alignct">
<thead>
<tr>
<th style="text-align: center;">Ad Headline</th>
<th style="text-align: center;">Ad ID</th>
<th style="text-align: center;">Ad Description 1</th>
<th style="text-align: center;">Ad Description 2</th>
<th style="text-align: center;">URL Appeared</th>
<th style="text-align: center;">Clicks</th>
<th style="text-align: center;">CPC</th>
<th style="text-align: center;">Conversions</th>
<th style="text-align: center;">CTR %</th>
<th style="text-align: center;">Impressions</th>
<th style="text-align: center;">Avg Pos</th>
<th style="text-align: center;">Cost</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
JS code:
$("#groupid").change(function(){
var oTable = $('#example1').dataTable();
var grpvalue=$('#groupid').val();
$.ajax({
type:"post",
dataType : 'json',
url:"pages/ads.php",
data:"adgroup="+grpvalue,
success: function(s) {
oTable.fnClearTable();
for(var i = 0; i < s.length; i++) {
oTable.fnAddData([
s[i]['hea']["0"],
s[i]['id']["0"],
s[i]['desc']["0"],
s[i]['desc2']["0"],
s[i]['url']["0"],
s[i]['cli']["0"],
s[i]['cpc']["0"],
s[i]['con']["0"],
s[i]['ctr']["0"],
s[i]['imp']["0"],
s[i]['ap']["0"],
s[i]['cost']["0"]
]);
}
}
});
});
And html table data is dynamic and I want to add a checkbox to each and every row.please let me know the procedure to do this.

render:fuunction()incolumnsdefinitions. See docs