Forum



18:19

08/09/2011

Hi, i just want to know how can i pass the parameters of the grid to my php file, in the "editurl" i tried something but i didnt work besides that launched me an error that the "id" wasn't defined. :S. thanks
var lastsel;
jQuery("#rowed3″).jqGrid({
url:'server2.php?q=2',
datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90, editable:true},
{name:'name',index:'name', width:100,editable:true},
{name:'amount',index:'amount', width:80, align:"right",editable:true},
{name:'tax',index:'tax', width:80, align:"right",editable:true},
{name:'total',index:'total', width:80,align:"right",editable:true},
{name:'note',index:'note', width:150, sortable:false,editable:true}
],
rowNum:10,
rowList:[10,20,30],
pager: '#prowed3',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
onSelectRow: function(id){
if(id && id!==lastsel){
jQuery('#rowed3').jqGrid('saveRow',lastsel);
jQuery('#rowed3').jqGrid('editRow',id,true);
lastsel=id;
}
},
editurl: "showparameters.php?rid="+id,
caption: "Using events example"
});
jQuery("#rowed3″).jqGrid('navGrid',"#prowed3″,{edit:true,add:false,del:false});
01:25

20/08/2011

hello,
As i have discovered, posting data to php is not a consistent or intuitive process.
When the grid is initially created or refreshed, the only data posted to php (via postData option) are the following: "_search", "nd", "page", "rows", "sidx" and "sord". These variables as far as i can remember are only mentioned at the bottom of this link: http://www.trirand.com/jqgridw.....first_grid .
_search: Will be true if you do a search, false otherwise. If true, you'll also get the "searchfield", "searchoper" and searchstring" for simple searching as well as "filters" for advanced searching.
nd: is a timestamp having to do with an IE problem.
page: Get the requested page. By default grid sets this to 1.
rows: get how many rows we want to have into the grid – by default the "rowNum" option parameter defined in the grid.
sidx: get index row – i.e. user click to sort. by default the "sortname" option parameter defined in the grid. If you select a column to sort, the "sortname" option parameter will be the index name from colModel.
sord: sorting order – by default the "sortorder" option parameter defined in the grid. Each time you click on a column header, the sort order option parameter will toggle.
The Row ID variable/name (id), Column variables/names and associated parameters are only posted when you initiate an edit, add or delete operation on the grid since you are attempting to modify database tables. During an edit, add or del operation, anything defined in postDATA will not get passed. When you create or refresh the grid, your only asking for data from the database so jqGrid does not post any column variables/parameters. Also, I believe what gets posted differs somewhat between edit, add and del.
In any case, this all happens automatically when you initially create the grid, or when you click on the refresh, edit, add or delete buttons in the navigation layer. No other user action is required.
If you need to post other variables and their parameters to php, there are a number of way to do it but i've found that other than passing them through the URL and EDITURL options as parameters, they are tricky to get functioning and the docs don't offer a lot of examples or explaination of the nuances. The other ways i have found but not been successful at getting to work are: editDATA and delDATA options, editGridRow and delGridRow methods, and the setGridParam method.
I still have not figured out how to get the editDATA and delDATA options to work.
The easiest way to find out what gets posted is to use something like Firebug with Firefox. It allows you to monitor and debug all activity between your browser page and the server script.
good luck.
00:56

20/08/2011

I found the solution to the problem with using the editData option. Please look at the floowing post link: http://www.trirand.com/blog/?p.....8;search=1
Most Users Ever Online: 715
Currently Online:
92 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