Forum



13:13

26/08/2011

Hi,
I am having tough time in getting the column value while I click on the + button of the main grid to show the subgrid. This column value will be passed as a parameter to subgrid (see below in bold)
Below is the code
<script type="text/javascript">
//<![CDATA[
$(function(){
$("#list").jqGrid({
url:"venue_listings.asp",
datatype: 'xml',
mtype: 'POST',
colNames:['Venue ID', 'Navigate', 'Record Date & Time', 'Venue Name', 'Venue Address', 'Has Floors'],
colModel :[
{name:'PK_VenueID', index:'PK_VenueID', width: 55, sortable:false, align:'center', hidden:false, sortable: true},
{name:'RowNavig', index:'RowNavig', width:140, sortable:false, align:'center', hidden:false, sortable: false},
{name:'RecordAddDateTime', index:'RecordAddDateTime', width:150, sortable:false, align:'center', hidden:false, sortable: true},
{name:'VenueName', index:'VenueName', width:250, sortable:true, align:'left', hidden:false, sortable: true},
{name:'VenueAddress', index:'VenueAddress', width:265, align:'left', hidden:false, sortable: true},
{name:'HasFloors', index:'HasFloors', width:80, align:'center', hidden:false, sortable: true}
],
rowNum:50,
rowList:[10,20,30,50,100],
pager: '#pager',
sortname: 'PK_VenueID',
sortorder: 'asc',
viewrecords: true,
rownumbers: true,
ignoreCase: true,
subGrid: true,
gridview: true,
caption: 'BELOW LIST SHOWS ALL THE VENUES WHICH ARE LISTED CURRENTLY IN THE DATABASE',
multiselect: false,
autowidth: true,
shrinkToFit: false,
height: 450,
subGridRowExpanded: function(subgrid_id, row_id)
{
// we pass two parameters
// subgrid_id is a id of the div tag created whitin a table data
// the id of this elemenet is a combination of the "sg_" + id of the row
// the row_id is the id of the row
// If we wan to pass additinal parameters to the url we can use
// a method getRowData(row_id) – which returns associative array in type name-value
// here we can easy construct the flowing
var subgrid_table_id, pager_id;
subgrid_table_id = subgrid_id+"_t";
pager_id = "p_"+subgrid_table_id;
$("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
jQuery("#"+subgrid_table_id).jqGrid({
url:"venue_list_floors.asp?q=2&venid"+ row_id,
datatype: "xml",
colNames: ['Floor ID','Floor Name', 'File/Image', 'Navigate'],
colModel: [
{name:"PK_VenueFloorID",index:"PK_VenueFloorID", width:50, key:true, align:"center", hidden:false, sortable:true},
{name:"VenueFloorName",index:"VenueFloorName", width:100, key:false, align:"left", sortable:true},
{name:"FileImage",index:"FileImage", width:100, key:false, align:"center", sortable:false},
{name:"SubRowNavig",index:"SubRowNavig", width:60, key:false, align:"center", sortable:false}
],
rowNum:50,
pager: pager_id,
rownumbers: true,
sortname: 'PK_VenueFloorID',
sortorder: "asc",
autowidth: true,
height: '100%'
});
jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false, search:false, refresh:true});
},
subGridRowColapsed: function(subgrid_id, row_id)
{
// this function is called before removing the data
var subgrid_table_id;
subgrid_table_id = subgrid_id+"_t";
jQuery("#"+subgrid_table_id).remove();
},
}).navGrid('#pager',{edit:false, add:false, del:false, search:false, refresh:true});
});
//]]>
</script>
Yashman Gupta
14:03

26/08/2011

Hi,
Just to update that I am able to get the column value (refere below in bold) but now the new issue has surfaced. The value captured in intVenID is now passed to the subgrid URL (see below in red) and subgrid is shown empty.
Anyone has any idea what is going wrong.
subGridRowExpanded: function(subgrid_id, row_id)
{
var subgrid_table_id, pager_id;
subgrid_table_id = subgrid_id+"_t";
pager_id = "p_"+subgrid_table_id;
var intVenID = jQuery('#list').jqGrid('getCell', row_id, 2);
$("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
jQuery("#"+subgrid_table_id).jqGrid({
url:"venue_list_floors.asp?q=2&venid="+ intVenID,
datatype: "xml",
colNames: ['Floor ID','Floor Name', 'File/Image', 'Navigate'],
colModel: [
{name:"PK_VenueFloorID",index:"PK_VenueFloorID", width:50, key:true, align:"center", hidden:false, sortable:true},
{name:"VenueFloorName",index:"VenueFloorName", width:100, key:false, align:"left", sortable:true},
{name:"FileImage",index:"FileImage", width:100, key:false, align:"center", sortable:false},
{name:"SubRowNavig",index:"SubRowNavig", width:60, key:false, align:"center", sortable:false}
],
Yashman Gupta
Most Users Ever Online: 715
Currently Online:
56 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