Jqgrid userData posting null value on update

I have a jqgrid and a form. When the grid is updated, I try to submit the form values ​​to the server side handler. For testing, I only use one variable per form. Firebug shows that jqgrid passes the field name, but the value is always null no matter what is selected.

According to the jqgrid docs, I have to handle this with the postData variable:

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

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

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


source to share


1 answer


I am late with this answer, but the trick is to use the function:



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

+7


source







All Articles