我有一些问题,我想使用 JqGrid 插件删除一些行
这是我的 php 删除函数,id 的数据库列是 idms_department
if($oper == 'del'){
$deptid = $_REQUEST['idms_department'];
$del = "DELETE FROM ms_department WHERE idms_department =" . $deptid;
if(mysql_query($del)){
"Delete Successfull";
} else {
die("Error Delete: " .mysql_error()."SQL : " .$del);
}
mysql_close();
}
和我的 jqgrid 设置
<script type="text/javascript">
$(document).ready(function() {
//alert("start");
jQuery("#departments").jqGrid({
mtype:'GET',
url:'functions/get_dept.php',
editurl:'functions/edit_dept.php',
datatype: "JSON",
colNames:['Department ID','Department'],
colModel:[
{name:'idms_department',index:'idms_department', width:150, editable:true,add:true, del:true, key:true},
{name:'department',index:'department', width:800,editable:true, add:true, del:true}
],
loadComplete: function () {
alert("OK");
},
loadError: function (jqXHR, textStatus, errorThrown) {
alert('HTTP status code: ' + jqXHR.status + '\n' +
'textStatus: ' + textStatus + '\n' +
'errorThrown: ' + errorThrown);
alert('HTTP message body (jqXHR.responseText): ' + '\n' + jqXHR.responseText);
},
rowNum:10,
rowList:[5,10,15],
pager: '#pager-departments',
sortname: 'idms_department',
viewrecords: true,
jsonReader: {repeatitems: true, idms_department: "idms_department" },
sortorder: "asc",
caption:"Example Departments"
});
jQuery("#departments").jqGrid('navGrid','#pager-departments',{edit:true,add:true,del:true});
jQuery("#departments").jqGrid('gridResize',{minWidth:350,maxWidth:850,minHeight:80, maxHeight:350});
//alert("end");
});
</script>
如何获取 idms_department 的值,因为我在我的萤火虫中看到,idms 无法识别(null)所以 sql 函数正在下降。