Forum


08:24

26/08/2009

I'm trying to send extra variables to the script that populates the grid. The information is stored in a form. From what I can tell, this is acomplished using userData. Indeed what I've got does submit the from field — but no the value.
I checked the javascript that pulls the form value. When used outside of the grid, it works used inside the gird it always posts null. Any help would be greatly appriciated.
Here's the client side code I'm working with. I've bolded the line in question.
jQuery(”#list”).jqGrid({
url:'poquery.php',
datatype: 'json',
mtype: 'POST',
colNames:['PO Number ','Date','Vendor','Dept','Buyer','Terms'],
colModel :[
{name:'PONUMB', index:'PONUMB', width:65},
{name:'PODATE', index:'PODATE', width:70},
{name:'POVEND', index:'POVEND', width:70},
{name:'POIDPT', index:'POIDPT', width:70},
{name:'POINIT', index:'POINIT', width:70},
{name:'TERMS', index:'TERMS', width:70},
],
postData: {POINIT : jQuery('#POINIT').val()},
pager: '#pager',
rowNum:10,
rowList:[10,20,30],
sortname: 'PONUMB',
sortorder: 'desc',
viewrecords: true,
caption: 'Purchase orders'
}).navGrid('#gridpager',{view:false,edit:false,add:false, del:false},
{}, // use default settings for edit
{}, // use default settings for add
{}, // delete instead that del:false we need this
{multipleSearch : true}, // enable the advanced searching
{closeOnEscape:true} /* allow the view dialog to be closed when user press ESC key*/
);
});
Here is a snipet from the form showing where the value is defined.
<?php
$buyers=getBuyerList();
foreach ($buyers as $buyer)
{
$init=$buyer->BUYER;
echo “<option value=\\”$init\\”>$init</option>”;
}
?>
</select></td>
Any help you can provide would be greatly appricated.
Edited to correct error. Function being used is postData -- not userData.
Thanks,
David Hamilton
If I understand/assume correctly, the POINIT is posted when retrieving the data when populating the grid, but not when editing or adding the data? "postData" property will not post it when editing, adding or deleting via the navGrid CRUD functions. For that you need to append it to the editUrl as in editUrl: myUrl + '?POINIT=' +$('#POINIT').val();
When you say it works outside of the grid, I am not sure how you or where you tested this, so try and do a console.log with Firebug or alert to show the value of POINIT just before the grid is defined, something like:
console.log($('#POINIT').val());
$('#list').jqGrid......
05:24

Moderators
30/10/2007

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
37 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66