Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Subgrid not collapsing
14/05/2010
17:45
Avatar
EvoBunny
Member
Members
Forum Posts: 4
Member Since:
14/05/2010
sp_UserOfflineSmall Offline

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.

17/05/2010
11:23
Avatar
EvoBunny
Member
Members
Forum Posts: 4
Member Since:
14/05/2010
sp_UserOfflineSmall Offline

As side note, I'm using jqgrid 3.6.5 and jquery 1.4.2

17/05/2010
22:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

17/05/2010
23:06
Avatar
EvoBunny
Member
Members
Forum Posts: 4
Member Since:
14/05/2010
sp_UserOfflineSmall Offline

This is the html and javascript I'm using to create the grids:   

<table id="countrylist"></table>
    <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:

header("Content-type: text/xml;charset=utf-8");
 
$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:

Image Enlarger

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.

20/05/2010
19:52
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

20/05/2010
20:32
Avatar
EvoBunny
Member
Members
Forum Posts: 4
Member Since:
14/05/2010
sp_UserOfflineSmall Offline

Ok, will quickly test with removing the navgrid line...

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information