jQuery / jqGrids / Submitting form data troubles...
Posted
by Kelso
on Stack Overflow
See other posts from Stack Overflow
or by Kelso
Published on 2010-03-03T22:14:18Z
Indexed on
2010/03/13
0:47 UTC
Read the original article
Hit count: 420
Ive been messing with jqgrids alot of the last couple days, and I have nearly everything the way I want it from the display, tabs with different grids, etc.
Im wanting to make use of Modal for adding and editing elements on my grid. My problem that Im running into is this. I have my editurl:"editsu.php" set, if that file is renamed, on edit, i get a 404 in the modal.. great! However, with that file in place, nothing at all seems to happen. I even put a die("testing"); line at the top, so it sees the file, it just doesnt do anything with it.
Below is the content. ........ the index page
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},{});
now for the editsu.php file..
$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());
}
Im just having a hard time troubleshooting this to figure out where its getting hung up at.
My next question after this would be to see if its possible to make it so when you click "add", that it auto inserts a row into the db with a couple variable predtermined and then bring up the modal window, but ill work on the first problem first.
thanks!
© Stack Overflow or respective owner