过去几天我一直在搞乱jqgrids,我几乎所有的东西都是我想要的,从显示器,不同网格的标签等等。
我想利用Modal在我的网格上添加和编辑元素。我遇到的问题是这个。我有我的editurl:“editsu.php”设置,如果该文件被重命名,在编辑时,我在模态中得到404 ..太棒了!但是,有了这个文件,似乎什么都没发生。我甚至放了一个模具(“测试”);在顶部的行,所以它看到文件,它只是没有做任何事情。
以下是内容。 ........ 索引页
jQuery("#landings").jqGrid({
url:'server.php?tid=1',
datatype: "json",
colNames:['ID','Tower','Sector', 'Client', 'VLAN','IP','DLink','ULink','Service','Lines','Freq','Radio','Serial','Mac'],
colModel:[
{name:'id', index:'id', width : 50, align: 'center', sortable:true,editable:true,editoptions:{size:10}},
{name:'tower', index:'tower', width : 85, align: 'center', sortable:true,editable:false,editoptions:{readonly:true,size:30}},
{name:'sector', index:'sector', width : 50, align: 'center',sortable:true,editable:true,editoptions:{readonly:true,size:20}},
{name:'customer',index:'customer', width : 175, align: 'left', editable:true,editoptions:{readonly:true,size:35}},
{name:'vlan', index:'vlan', width : 35, align: 'left',editable:true,editoptions:{size:10}},
{name:'suip', index:'suip', width : 65, align: 'left',editable:true,editoptions:{size:20}},
{name:'datadl',index:'datadl', width:55, editable: true,edittype:"select",editoptions:{value:"<? $qr = qquery("select * from datatypes"); while ($q = ffetch($qr)) {echo "$q[id]:$q[name];";}?>"}},
{name:'dataul', index:'dataul', width : 55, editable: true,edittype:"select",editoptions:{value:"<? $qr = qquery("select * from datatypes"); while ($q = ffetch($qr)) {echo "$q[id]:$q[name];";}?>"}},
{name:'servicetype', index:'servicetype', width : 85, editable: true,edittype:"select",editoptions:{value:"<? $qr = qquery("select * from servicetype"); while ($q = ffetch($qr)) {echo "$q[id]:$q[name];";}?>"}},
{name:'voicelines', index:'voicelines', width : 35, align: 'center',editable:true,editoptions:{size:30}},
{name:'freqname', index:'freqname', width : 35, editable: true,edittype:"select",editoptions:{value:"<? $qr = qquery("select * from freqband"); while ($q = ffetch($qr)) {echo "$q[id]:$q[name];";}?>"}},
{name:'radioname', index:'radioname', width : 120, editable: true,edittype:"select",editoptions:{value:"<? $qr = qquery("select * from radiotype"); while ($q = ffetch($qr)) {echo "$q[id]:$q[name];";}?>"}},
{name:'serial', index:'serial', width : 100, align: 'right',editable:true,editoptions:{size:20}},
{name:'mac', index:'mac', width : 120, align: 'right',editable:true,editoptions:{size:20}}
],
rowNum:20,
rowList:[30,50,70],
pager: '#pagerl',
sortname: 'sid',
mtype: "GET",
viewrecords: true,
sortorder: "asc",
altRows: true,
caption:"Landings",
editurl:"editsu.php",
height:420
});
jQuery("#landings").jqGrid('navGrid','#pagerl',{edit:true,add:true,del:false,search:false},{height:400,reloadAfterSubmit:false},{height:400,reloadAfterSubmit:false},{reloadAfterSubmit:false},{});
现在为editsu.php文件..
$operation = $_REQUEST['oper'];
if ($operation == "edit") {
qquery("UPDATE customers SET vlan = '".$_POST['vlan']."', datadl = '".$_POST['datadl']."', dataul = '".$_POST['dataul']."', servicetype = '".$_POST['servicetype']."', voicelines = '".$_POST['voicelines']."', freqname = '".$_POST['freqname']."', radioname = '".$_POST['radioname']."', serial = '".$_POST['serial']."', mac = '".$_POST['mac']."' WHERE id = '".$_POST['id']."'") or die(mysql_error());
}
我只是很难对其进行故障排除,以确定它在哪里被挂断。
我的下一个问题就是看看当你点击“添加”时它是否可以这样做,它会自动在数据库中插入一行并预测几个变量,然后调出模态窗口,但是生病了首先解决第一个问题。
谢谢!
答案 0 :(得分:1)
我没有在任何地方看到回叫功能。从server.php返回响应后会发生什么?
答案 1 :(得分:0)
几个问题:
杰罗姆