Forum


Hi, I'm new on the forum and started using jqGrid and what a plugin! I just love it, but currently stuck with a scenario with regards to subgrids which is annoying me and I cannot find the answer.
I have a grid as a subgrid which expands 100% fine, but the plus sign never turns into a minus sign and when I try to collapse the subgrid, it opens another subgrid rather than collapsing/removing the subgrid.
Anybody have any suggestions as to what the problem might be? Thanks a million in advance.
22:33

Moderators
30/10/2007

Hello,
Will be great if you send a link to 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.
This is the html and javascript I'm using to create the grids:
<div id="countrylistpager"></div>
<script language="javascript">
var lastsel;
$("#countrylist").jqGrid({
url: '<?php echo MODX_BASE_URL; ?>../ajax/countrylist.ajax.php',
datatype: 'xml',
mtype: 'POST',
colNames: ['Country Name','Country Code', 'Currency Name', 'Currency Code', 'Conversion Rate'],
colModel: [
{name:'countryname', index:'countryname'},
{name:'countrycode', index:'countrycode'},
{name:'currencyname', index:'currencyname', sortable: false},
{name:'currencycode', index:'currencycode', sortable: false},
{name:'currencyconversionrate', index:'currencyconversionrate', sortable: false}
],
pager: '#countrylistpager',
rowNum: 15,
rowList: [15, 25, 50],
sortname: 'countryname',
sortorder: 'asc',
viewrecords: true,
hidegrid: false,
caption: 'Country List',
subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id) {
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>");
$("#"+subgrid_table_id).jqGrid({
url: '<?php echo MODX_BASE_URL; ?>../ajax/countryregionslist.ajax.php?countrycode=' . $row_id,
datatype: "xml",
mtype: "POST",
colNames: ['Region Name','Region Code'],
colModel: [
{name:"countryregionname", index:"countryregionname"},
{name:"countryregioncode", index:"countryregioncode"}
],
rowNum:15,
rowList: [15, 25, 50],
pager: pager_id,
sortname: 'countryregionname',
sortorder: "asc",
height: '100%'
});
$("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id, {edit:false,add:false,del:false});
}, subGridRowColapsed: function(subgrid_id, row_id) {
}
});
$("#countrylist").jqGrid('navGrid',"#countrylistpager", {edit:false,add:false,del:false});
</script>
The main grid works fine, and here is the contents of the php file which returns the results for the subgrid:
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach($country->GetRegions() as $countryregion)
{
$s .= "<row id='" . $countryregion->GetCountryRegionCode() . "'>";
$s .= "<cell><![CDATA[" . $countryregion->GetCountryRegionName() . "]]></cell>";
$s .= "<cell>" . $countryregion->GetCountryRegionCode() . "</cell>";
$s .= "</row>";
}
$s .= "</rows>";
echo $s;
The xml the above php file returns is fine with no xml errors, but for some reason I get the following when expanding the subgrid, I've encircled the plus which remains a plus, and it keeps adding another subgrid:
The result set of the of the above regions is empty, there isn't a problem retrieving the data, it's just the subgrid doesn't want to collapse.
Hope this helps.
19:52

Moderators
30/10/2007

Hello,
It seems that there is some error when the grid is created, since we immediatley switch to another icon after the expanding a row.
The only code that can raise the error is navGrid. Try first to comment this and see the result. Also in the picture attached i do not see any navigator buttons.
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:
45 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