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
Multiple sub grids
01/08/2008
21:56
Avatar
milo
Davao City, Philippines
Member
Members
Forum Posts: 10
Member Since:
01/08/2008
sp_UserOfflineSmall Offline

Hi,

would it be possible if there would be a multiple instance of subgrids?

i tried implementing but i got confused...heres the code....

jQuery(document).ready(function(){   
    jQuery("#list").jqGrid({
        url:'example.php',
        datatype: 'xml',
        mtype: 'GET',
        height: 700,               
        colNames:['ID','Category', 'Description'],
        colModel :[
            {name:'cat_id', index:'catid', width:55},   
            {name:'cat_title', index:'title', width:290},
            {name:'cat_desc', index:'description', width:380}],
        pager: jQuery('#pager'),
        rowNum:10,
        rowList:[10,20,30],
        sortname: 'catid',
        sortorder: "desc",
        viewrecords: true,
        imgpath: 'themes/basic/images',
        caption: 'Categories',
        subGrid: true,
        subGridRowExpanded: function(subgrid_id, row_id){
            var subgrid_table_id, pager_id;
            var subgrid_table_id2, pager_id2;
           
            subgrid_table_id = subgrid_id+"_t";           
            pager_id = "p_"+subgrid_table_id;

            subgrid_table_id2 = subgrid_id+"_t2";
            pager_id2 = "p_"+subgrid_table_id2;
           
                       
            $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
            jQuery("#"+subgrid_table_id).jqGrid({
                url:"subgrid.php?q=2&id="+row_id,
                datatype: "xml",
                colNames: ['ID','Product','Description'],
                colModel: [
                    {name:"pid",index:"pid",width:55,key:true,editable: true,edittype:"checkbox",editoptions: {value:"Yes:No"}},
                    {name:"p_title",index:"title",width:300, editable: true},
                    {name:"p_desc",index:"description",width:1, editable: true},
                    ],
                rowNum:20,
                pager: jQuery('#'+pager_id),
                imgpath: 'themes/basic/images',
                caption: 'Attributes',                               
                height: '100%'
                }).navGrid('#'+pager_id,{refresh: true,edit:true,add:true,del:true,search:true});//end jqgrid

                $("#"+subgrid_id).html("<table id='"+subgrid_table_id2+"' class='scroll'></table><div id='"+pager_id2+"' class='scroll'></div>");
                jQuery("#"+subgrid_table_id2).jqGrid({
                    url:"subgrid.php?q=2&id="+row_id,
                    datatype: "xml",
                    colNames: ['ID','Product','Description'],
                    colModel: [
                        {name:"pid",index:"pid",width:55,key:true,editable: true,edittype:"checkbox",editoptions: {value:"Yes:No"}},
                        {name:"p_title",index:"title",width:300, editable: true},
                        {name:"p_desc",index:"description",width:1, editable: true},
                        ],
                    rowNum:20,
                    pager: jQuery('#'+pager_id2),
                    imgpath: 'themes/basic/images',
                    caption: 'Attributes',                               
                    height: '100%'
                    }).navGrid('#'+pager_id2,{refresh: true,edit:true,add:true,del:true,search:true});//end jqgrid
               
            }//end function
        }).navGrid('#pager',{refresh: true,edit:true,add:true,del:true,search:true});
    }); //end ready function

would this be possible.... or maybe i did something wrong here....

thnx... 🙂

02/08/2008
04:00
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

I do not understand what you mean but,

$("#maingrid").jqGrid({

.....

subGridRowExpanded : function(subgrid_id, row_id){

...

$("#subgrid_t").jqGrid({

.......

subGridRowExpanded : function(sub_subgrid_id, row_id){

....

$("#sub_subgrid_t").jqGrid({

.......

}) // sub_subgrid_t

}

}) // subgrid_t

} // subgrid_id

}) // maingrid

Hope this help

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.

03/08/2008
19:32
Avatar
milo
Davao City, Philippines
Member
Members
Forum Posts: 10
Member Since:
01/08/2008
sp_UserOfflineSmall Offline

i mean... would it be possible to create to instances of grid as subgrid... for example...

$(”#maingrid”).jqGrid({

.......

subGridRowExpanded : function(subgrid_id, row_id){

....

$(”#subgrid_t”).jqGrid({

....

});//end subgrid_t

//this kind of an instance..

$(”#subgrid_t2”).jqGrid({

....

});//end subgrid_t2

}//end function

.......

});//end main grid

thnx.. 🙂

03/08/2008
20:32
Avatar
milo
Davao City, Philippines
Member
Members
Forum Posts: 10
Member Since:
01/08/2008
sp_UserOfflineSmall Offline

or logically it can be portrayed as this:

MAINGRID

->SUBGRID1

->SUBGRID2

SUBGRID2 is not inside the SUBGRID1.. instead both of them are on the same level pointing to MAINGRID...

thnx.. 🙂

04/08/2008
04:59
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Aha,

Maybe you should append (use append) the content of the second subgrid after the first one.

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.

05/08/2008
19:14
Avatar
milo
Davao City, Philippines
Member
Members
Forum Posts: 10
Member Since:
01/08/2008
sp_UserOfflineSmall Offline

how do i append? m not sure how it works??

tnx...

06/08/2008
00:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Maybe when you create the first subgrid, then

$(”#”+subgrid_id).appent("second_table")

$("#secondtable_id").jqGrid({...});

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.

06/08/2008
03:26
Avatar
milo
Davao City, Philippines
Member
Members
Forum Posts: 10
Member Since:
01/08/2008
sp_UserOfflineSmall Offline

ic.. ill try it out... thnx

30/05/2009
17:23
Avatar
bogho
New Member
Members
Forum Posts: 2
Member Since:
06/04/2008
sp_UserOfflineSmall Offline

Hello,

It will be helpfull if you can sahre your code, I spend hours to make it works.

Thanks a lot.

Bogho

09/06/2009
07:36
Avatar
bogho
New Member
Members
Forum Posts: 2
Member Since:
06/04/2008
sp_UserOfflineSmall Offline

Hello,

I have requirement to get 2 subgrids for the main grid.

After couple of days I can't get it works, so any suggestions are welcome.

Thanks for any help.

Bogho.

01/10/2010
17:27
Avatar
downunder
Member
Members
Forum Posts: 9
Member Since:
12/11/2009
sp_UserOfflineSmall Offline

Bogho...

i'm on the same search now... did you find out and have some code to share?

Ananda 

01/10/2010
17:57
Avatar
downunder
Member
Members
Forum Posts: 9
Member Since:
12/11/2009
sp_UserOfflineSmall Offline

OK. I found it out….

append() did the trick? 

for he second subgrid in a line U use append() instead of html() to add the table html of the second to the previous grid.

//for a second subgrid on the same level

subgrid_table_id = subgrid_id+"_tt"; //new name for table selector –> tt

pager_id = "p_"+subgrid_table_id;

$("#"+subgrid_id).append("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>"); 

jQuery("#"+subgrid_table_id).jqGrid({

});

works nice!

Daniel

22/11/2010
15:33
Avatar
cba_cruz
Guatemala
Member
Members
Forum Posts: 8
Member Since:
11/11/2010
sp_UserOfflineSmall Offline

Hi there, im using 4 subgrids on the same level, the first subgrid show the pager correctly, with total pages correct and lets me paginate through, but the second, third and forth subgrid doesn't show the total pages nor lets me paginate, did i do something wrong? or did you even had this problem?

Thanx!

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
62 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