我是tabledit的新手,我尝试遵循markcell github和tabledit的一些教程。但他们在codeigniter中都没有,我有这个问题,但没有一个给我正确的答案
我已经尝试使用查询生成器输入帖子并过滤我的输入数组。
<div class="container">
<div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="table-responsive">
<table id="myTable" class="table">
<thead class="thead">
<tr>
<th>id</th>
<th>Waktu</th>
<th>Ruangan</th>
<th>Keahlian</th>
</tr>
</thead>
<tbody>
<?php
foreach ($query->result() as $row) {
echo "<tr>";
echo "<td>";
echo $row->id_seminar;
echo "</td>";
echo "<td>";
echo date("l, d-m-y h:i", strtotime($row->tanggal));
echo "</td>";
echo "<td>";
echo $row->ruang;
echo "</td>";
echo "<td>";
echo $row->keahlian;
echo "</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('#myTable').Tabledit({
url:'<?php echo base_url('admin/c_admin_jadwal/tabledit');?>',
columns:{
identifier:[0, "id"],
editable:[[1,'Waktu'],[2, 'Ruangan'], [3, 'Keahlian']]
},
hideIdentifier: true,
onDraw: function() {
console.log('onDraw()');
},
onSuccess: function(data, textStatus, jqXHR) {
console.log('onSuccess(data, textStatus, jqXHR)');
console.log(data);
console.log(textStatus);
console.log(jqXHR);
},
onFail: function(jqXHR, textStatus, errorThrown) {
console.log('onFail(jqXHR, textStatus, errorThrown)');
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
},
onAlways: function() {
console.log('onAlways()');
},
onAjax: function(action, serialize) {
console.log('onAjax(action, serialize)');
console.log(action);
console.log(serialize);
}
});
});
</script>
public function tabledit(){
header('Content-Type: application/json');
$input = filter_input_array(INPUT_POST);
$mysqli = new mysqli('localhost', 'root', '', 'sistemkp');
if ($input['action'] === 'edit') {
$query = "UPDATE seminar SET tanggal = '". $input["Waktu"]."',
ruang = '". $input["Ruangan"] ."',
keahlian = '". $input["keahlian"] ."',
WHERE id_seminar = '".$input["id"]."'";
$mysqli->query($query);
}
mysqli_close($mysqli);
echo json_encode($input);
我尝试使用mozila firefox中的控制台跟踪数据,发现我的输入信息为空。请帮助我解决此问题,谢谢