Forum


21:56

01/08/2008

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... 🙂
04:00

Moderators
30/10/2007

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.
19:32

01/08/2008

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.. 🙂
20:32

01/08/2008

04:59

Moderators
30/10/2007

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.
19:14

01/08/2008

00:22

Moderators
30/10/2007

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.
03:26

01/08/2008

17:57

12/11/2009

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
15:33

11/11/2010

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!
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66