1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<!-- jQuery -->
<script src="../../../charisma-master/bower_components/jquery/jquery.min.js"></script>
<script type="text/javascript" language="javascript" src="JQuery/jquery-1.11.3.min.js"></script>
<script type="text/javascript" language="javascript" src="JQuery/jquery-ui.js"></script>
<script type="text/javascript" language="javascript" src="DataTables-1.10.7/media/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="DataTables-1.10.7/extensions/TableTools/js/dataTables.tableTools.min.js"></script>
<script type="text/javascript" language="javascript" src="../../js/dataTables.editor.js"></script>
<script type="text/javascript" language="javascript" src="../resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" class="init">
var editor; // use a global for the submit and return data rendering in the examples
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
"ajax": "../php/checkbox.php",
"table": "#example",
"fields": [ {
label: "chauffeur:",
name: "chauffeur",
type: "checkbox",
separator: "|",
options: [
{ label: '', value: 1 }
]
}, {
label: "nom:",
name: "nom"
}, {
label: "prénom",
name: "prénom"
}, {
label: "grade:",
name: "grade"
}
]
} );
$('#example').dataTable( {
dom: "Tfrtip",
ajax: "../php/checkbox.php",
columns: [
{ data: "nom" },
{ data: "prénom" },
{ data: "grade" },
{
data: "chauffeur",
render: function ( data, type, row ) {
if ( type === 'display' ) {
return '<input type="checkbox" class="editor-active">';
}
return data;
},
className: "dt-body-center"
}
],
tableTools: {
sRowSelect: "os",
aButtons: [
{ sExtends: "editor_edit", editor: editor }
],
sRowSelector: 'td:not(:last-child)' // no row selection on last column
},
rowCallback: function ( row, data ) {
// Set the checked state of the checkbox in the table
$('input.editor-active', row).prop( 'checked', data.chauffeur == 1 );
}
} );
$('#example').on( 'change', 'input.editor-active', function () {
editor
.edit( $(this).closest('tr'), false )
.set( 'chauffeur', $(this).prop( 'checked' ) ? 1 : 0 )
.submit();
} );
} );
</script>
</head>
<body background="armee-nationale.jpg" class="dt-example">
<div class="container">
<section>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="100%">
<thead>
<tr>
<th>الاسم</th>
<th>اللقب</th>
<th>الرتبة</th>
<th>سائق</th>
</tr>
</thead>
</table>
</section>
</div>
<!-- external javascript -->
<script src="../../../charisma-master/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- select or dropdown enhancer -->
<script src="../../../bower_components/chosen/chosen.jquery.min.js"></script>
</body>
</html> |
Partager