Forum


05:00

13/02/2010

Hi,
I would like to call a php script from jqgrid to generate a chart (with the jpgraph tool) or generate a pdf with tcpdf.
This is no problem: I could do an ajax request to makechart.php and put the result somewhere on my page.
My problem is: How do I add the data from the actual jqgrid search specification that is posted for example when refreshing the grid?
For exampleI would like to have a button which calls onclick:
jQuery.post('makechart.php', postdata, callbackFunc, type)
but I do not know how to fill postdata with the "standard" post data that is transmited for a search or a page refresh.
I would be happy to get a hint on this.
Dirk
19:13

13/02/2010

I found the solution: myPostData=jQuery("#mygrid").getPostData()) gives me the data posted by jqgrid.
If anyone is interested in using this with jpgraph one should consider that it is hard to send via 'POST' to jpgraph.
Instead it is easy to use 'GET':
jQuery('#my HtmlElement').html('<img src="mygraph.php'+getRequest+'" />');
where getRequest can be obtained from myPostData the following way:
getRequest='?'+concatObject(myPostData);
with
function concatObject(obj) {
str='';
for(prop in obj)
{
str+=prop + "="+ obj[prop]+"&";
}
return(str);
Most Users Ever Online: 715
Currently Online:
72 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