Forum


07:48

01/02/2009

Hi, I'm new to jQuery, jqGrid, etc. and could use some assistance.
I'm using PHP/MySQL to produce the following JSON data. which is what displays when I load the page:
{"page":1,"total":1,"records":"3","rows":[{"cell":["1225679075","2008-11-02","Bob Smith",null,null,null,""]},{"cell":["1225596954","2008-11-01","AJ Sedlak",null,null,null,""]},{"cell":["1225596923","2008-11-01","AJ Sedlak",null,null,null,""]}]}
Here's my code:
jQuery(document).ready(function(){
jQuery("#rowed2").jqGrid({
url:'index.php?form=<?=$form?>',
datatype: "json",
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: true,
cell: "cell",
id: "requestID"
},
colNames:['Request ID','Date', 'Name','Location','Priority','Status','Actions'],
colModel:[
{name:'requestID', index:'requestID', width:55},
{name:'requestDate', index:'requestDate', width:90},
{name:'requester', index:'requester', width:80},
{name:'location', index:'location', width:80},
{name:'priority', index:'priority', width:80},
{name:'status', index:'status', width:150},
{name:'act',index:'act', width:75,sortable:false}
],
rowNum:30,
rowList:[30,40,50],
imgpath: gridimgpath,
pager: jQuery('#prowed2'),
sortname: 'requestID',
viewrecords: true,
sortorder: "desc",
loadComplete: function(){
var ids = jQuery("#rowed2").getDataIDs();
for(var i=0;i<ids.length;i++){
var cl = ids[i];
be = "<input style='height:22px;width:20px;' type='button' value='E' onclick=jQuery('#rowed2').editRow("+cl+"); ></ids>";
se = "<input style='height:22px;width:20px;' type='button' value='S' onclick=jQuery('#rowed2').saveRow("+cl+"); />";
ce = "<input style='height:22px;width:20px;' type='button' value='C' onclick=jQuery('#rowed2').restoreRow("+cl+"); />";
jQuery("#rowed2").setRowData(ids[i],{act:be+se+ce})
}
},
editurl: "index.php?form=<?=$form?>",
caption:"<?=$formname ?> Request Queue - Open Tickets "
}).navGrid("#prowed2",{edit:false,add:false,del:false});
});
jQuery Version: 1.3.1
jqGrid version: 3.4 beta 2
Thanks!
-AJ
01:23

Moderators
30/10/2007

Hello,
What is the problem?
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.
01:50

Moderators
30/10/2007

Hello,
I think you should construct the grid first and then use another url to obtain the data. If your data and grid are in the same php call page nothing will be happen. To avoid this you can solve this using datastr parameter first. Read the docs.
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:
37 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