我有一个表单,当我删除Datatables时,它正常工作。但是,当我将<table id='example'>
用于使用数据表时,它不会提交表单。如果我把echo form_open
放在它之前它没有正常工作,它只插入teacher_id = 13,但对于我选择的行没有不同。这是我的观点:
<html>
<head>
<link href="//cdn.datatables.net/1.10.5/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="//cdn.datatables.net/1.10.2/js/jquery.dataTables.js"></script>
<script src="//cdn.datatables.net/1.10.2/js/jquery.dataTables.js">
<script src="../../media/js/dataTables.editor.min.js"></script>
<script>
$(document).ready(function() {
$('#example').dataTable( {
"pagingType": "full_numbers",
"bSort": true,
"sDom": 'T<"clear">lfrtip',
// "pagingType": "scrolling",
"tableTools": {
"sSwfPath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf",
"aButtons": [
"csv",
{
"sExtends": "pdf",
"sButtonText": "Print PDF",
"mColumns": "visible"
},
"xls"
]
}
} );
} );
</script>
<script>
$(document).ready(function() {
$('#example tfoot th').each( function () {
var title = $('#example thead td').eq( $(this).index() ).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" />' );
} );
var table = $('#example').DataTable();
table.columns().eq( 0 ).each( function ( colIdx ) {
$( 'input', table.column( colIdx ).footer() ).on( 'keyup change', function () {
table
.column( colIdx )
.search( this.value )
.draw();
} );
} );
} );
</script>
<?php
echo validation_errors();
?>
<table id='example'>
<thead>
<tr>
<th>Teachers</th>
<th>Coord.</th>
<th>Change coord.</th>
<th>Deactivate teacher</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Teachers</th>
<th>Coord.</th>
<th>Change coord.</th>
<th>Deactivate teacher</th>
</tr>
</tfoot>
<tbody>
<?php
foreach ($teachers_show as $teacher)
{
echo form_open('coordinator/deactivate_teacher');
?>
<tr>
<td>
<?php echo $teacher->username;
?>
</td>
<td>
<?php echo $teacher->coordinator_id; ?>
</td><td>
<?php
echo '<a href="edit_coordinator/' . $teacher->user_id . '" class="btn btn-success" id="change_coord"> Change </a>';
?>
</td><td>
<?php
echo "<input type='hidden' name='teacher' value='$teacher->user_id' />";
echo '<input type="submit" name="deactivate" value="Деактивирай учител" id="change_coord" class="btn btn-danger" onclick="return confirm(\'Are you sure you want to deactivate?\'); " />';
?>
</td></tr>
<?php
echo form_close();
}
?>
</tbody>
</table>
</div>
</body>
</html>
&#13;