admin管理员组文章数量:1332881
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
1 Answer
Reset to default 7I'm way late with this reply, but the trick is to use a function:
postData: {POINIT : function() { return $('#POINIT').val(); }}
本文标签: javascriptjqgrid userData posting null on refreshStack Overflow
版权声明:本文标题:javascript - jqgrid userData posting null on refresh - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742308385a2450376.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论