Forum



16:07

13/02/2013

I'm a newbie to jqgrid. This is what I'm planning to do....
I have a working jqgrid with all the data . When a user clicks on a row, I want to show additional details for that row , all the data for the details are in the gris as hidden .
My question is how do I retrieve the data for that particular row which is hidden in the parent grid. I was using "+$("#grid").getCell (postdata, 'deviceName') , but of no use...
Here is my code
<script type='text/javascript'>
$(function() {
$("#grid").jqGrid({
url:'${recordsUrl}',
datatype: 'json',
mtype: 'GET',
colNames:['serverId', 'deviceName', 'businessUnit'],
colModel:[
{name:'serverId',index:'serverId', width:100, editable:true, editrules:{required:true}, editoptions:{size:10}},
{name:'deviceName',index:'deviceName', width:100, editable:true, editrules:{required:true}, editoptions:{size:10}},
{name:'businessUnit',index:'businessUnit', width:50, editable:true, editrules:{required:true}, editoptions:{size:10}}
],
postData: {},
rowNum:10,
rowList:[10,20,40,60],
height: 240,
autowidth: true,
rownumbers: true,
pager: '#pager',
sortname: 'serverId',
viewrecords: true,
sortorder: "asc",
caption:"Records",
subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id) {
var html = "<span>ZZ19 Some HTML text which corresponds the row with id="+$("#grid").getCell (postdata, 'deviceName')+
row_id + " xxy </span><br/>";
$("#" + subgrid_id).append(html);
},
emptyrecords: "Empty records",
loadonce: true,
loadComplete: function() {},
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "serverId"
}
});
10:00

Moderators
30/10/2007

Hello,
You can use the getRowData method.
If you know the id you can get the entrie row of the grid, instead that some fields are hidden.
So you code of subGridRowExpanded cal look like
....
subGridRowExpanded : function(subgrid_id, row_id) {
var selectedrow = $(this).jqGrid('getRowData', row_id);
// now you can use selectedrow.myhiddenfield
...
},
...
Regards
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:
36 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