Forum


09:39

10/04/2009

i am using the jqgrid example and added the onSelectRow to run some javascript code but I get undefined id and it can't find the row id even though I set the key and even set the row id in the server php code.
Here's the code:
jQuery(”#bigset”).jqGrid({
url:'bigset.php',
datatype: “json”,
height: 150,
colNames:['Index','Name', 'Code'],
colModel:[
{name:'id',index:'item_id', key:true, width:65},
{name:'item_name',index:'item_name', width:150},
{name:'item_cd',index:'item_cd', width:100}
],
rowNum:5,
//rowList:[10,20,30],
imgpath: 'themes/basic/images',
mtype: “GET”,
pager: jQuery('#pagerb'),
sortname: 'item_id',
viewrecords: true,
sortorder: “asc”,
onSelectRow: function() {alert(id);}
});
This is the section in php that sets the row id
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$responce->rows[$i]['id']=$row[item_id];
$responce->rows[$i]['cell']=array($row[item_id], $row[item_name],$row[item_cd]);
$i++;
}
Your help will be highly appreciated.
Son
02:49

Moderators
30/10/2007

Hello,
If you set key:true, you do not need to provide the id from server.
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:
88 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