javascript - jqgrid userData posting null on refresh - Stack Overflow

I have a jqgrid and a form. When the grid is refreshed, I am attempting to send the values of the form

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.

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.

Share Improve this question edited Aug 26, 2009 at 19:40 Craig Stuntz 127k12 gold badges256 silver badges275 bronze badges asked Aug 26, 2009 at 10:15 David HamiltonDavid Hamilton 2431 gold badge7 silver badges17 bronze badges 1
  • This works for me, so I suspect you either aren't setting what you think you are in the grid initialization or you're overwriting it. I've never seen postData fail, and I set it much like you do above. Debug the val() result! – Craig Stuntz Commented Aug 26, 2009 at 19:42
Add a ment  | 

1 Answer 1

Reset to default 7

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742308386a4419399.html

相关推荐

  • javascript - jqgrid userData posting null on refresh - Stack Overflow

    I have a jqgrid and a form. When the grid is refreshed, I am attempting to send the values of the form

    20小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信