Forum


23:26

16/12/2008

Hi Tony, or anyone familiar with postext.js,
Can someone point me in the right direction on postext.js? I've been all around it and can't make it work the way I think it should. I'm trying to use setPostDataItem to manipulate "oper" on POST. I'll also be trying to appendPostData for some additional params that I need to pass to PHP.
I know grid.postext.js is loading and the function is executing (by way of alert(), etc), but I never see my POST data modified as per firebug.
Here is a snippet of the grid code showing that I'm executing setPostDataItem on onclickSubmit()
{},
{closeAfterEdit:false,
editCaption:'Edit Link',
height:150,
reloadAfterSubmit:true,
url:'.assets/admin_funcs.php?oper=updlnkx',
width:450
},
{addCaption:'Add Link',
clearAfterAdd:true,
closeAfterAdd:false,
height:150,
reloadAfterSubmit:true,
url:'.assets/admin_funcs.php',
width:450,
beforeShowForm:function(formid){
jQuery("#pop").val("addlnk");
jQuery("#link",formid).val("http://");
},
onclickSubmit:function(){
jQuery("#mylinks_grid_table").setPostDataItem('oper','addlnk');
},
afterComplete:function(serverResponse,postdata,formid){
jQuery("#pop",formid).val("addlnk");
jQuery("#link",formid).val("http://");
}
},
I've tried a variety of other postext methods just to test, but have yet to get any of them working. I've also tried manupulating POST params that are defined in the colModel (thinking that maybe the non-colModel POST params aren't exposed for manipulation??), but no success there either.
I'd much rather use postext if possible - as it stands, I'm having to add hidden columns in colModel to use in passing "extra" POST data, which I don't think is a very clean way to do things.
Thanks,
Adam
09:58

Moderators
30/10/2007

Hello,
I'm not sure you should use this. As per docs onclickSubmit should return object which then is extended to the post data. Try this (not tested) it should work:
onclickSubmit : function () {
// if you want add to all grid parameters here is a better solution
jQuery(”#mylinks_grid_table”).setGridParam({postData:{oper:'addlink'}});
// but here is the right return
return {oper:'addlink'}
}
REgards
Tony
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:
84 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