views:

1801

answers:

2

I have a jqgrid and a form. When the grid is refreshed, I am attempting to send the values of the form to the server side handler. For testing, I'm using just one variable in the form. Firebug shows that jqgrid is passing the field name, but the value is always null regardless of what is selected.

According the the jqgrid docs, I should be handling this using the postData variable:

postData: {POINIT : jQuery('#POINIT').val()}

I've also tested this to ensure that calling the jQuery to get the value works on other parts of the page -- just not when the grid is refreshed.

Here's the relevant code:

jQuery(document).ready(funcion(){ 
  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} 
);

});

Any help would be greatly appreciated.

+1  A: 

I'm way late with this reply, but the trick is to use a function:

postData: {POINIT : function() { return $('#POINIT').val(); }}

Ryan
A: 

Nice! You gotta love this js delegate stuff

Steve