179
rated 0 times
[
181]
[
2]
/ answers: 1 / hits: 42786
/ 12 Years ago, wed, january 2, 2013, 12:00:00
I am using Datatables and I have the following code to generate the table. I want to display checkboxes for the read, write, execute and admin values.
If the value is equal to 1 , I want the checkbox to be checked. and if 0 checkboxes unchecked.
Javascript
<script type=text/javascript charset=utf-8>
$(document).ready(function() {
var oTable = $('#example').dataTable( {
sScrollY: 500px,
bPaginate: false,
bProcessing: true,
sAjaxSource: sources/sample.json
} );
} );
</script>
HTML
<table cellpadding=0 cellspacing=0 border=0 class=display id=example>
<thead>
<tr>
<th width=20%>Browser</th>
<th width=25%>Read</th>
<th width=25%>Write</th>
<th width=15%>Execute</th>
<th width=15%>Admin</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
JSON
{ aaData: [
[Trident,0,0,0,1],
[Trident,0,1,0,0],
[Trident,0,0,1,1],
[Trident,0,0,1,1],
[Trident,0,0,1,1],
[Trident,0,0,0,0],
[Gecko,1,1,1,1],
[Gecko,0,0,0,1],
[Other browsers,1,0,0,U]
] }
More From » jquery