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
Grid as Subgrid problem
30/11/2008
13:48
Avatar
snip3r05
Portugal
Member
Members
Forum Posts: 9
Member Since:
16/11/2008
sp_UserOfflineSmall Offline

Hi.

I have this grid and subgrid

jQuery("#listsg11").jqGrid({
       url:'server.php?q=4',
    datatype: "json",
    height: 190,
       colNames:['Id', 'seccao', 'total','Data'],
       colModel:[
           {name:'id',index:'id', width:55},
           {name:'seccao',index:'seccao', width:100},
       ],
       rowNum:6,
       rowList:[8,10,20,30],
       imgpath: 'themes/sand/images',
       pager: jQuery('#pagersg11'),
       sortname: 'id',
    viewrecords: true,
    sortorder: "desc",
    multiselect: false,
    subGrid: true,
    caption: "Grid as Subgrid",
    subGridRowExpanded: function(subgrid_id, row_id) {
        var subgrid_table_id, pager_id;
        subgrid_table_id = subgrid_id+"_t";
        pager_id = "p_"+subgrid_table_id;
        rowdata = jQuery("#pagersg11").getRowData(row_id);
        seccao=rowdata['seccao'];
        alert(seccao);   
    },
My problem is in the variable seccao that never as a value the alert always

shows "undefined".

Can u tell me what i am doing wrong?

Best Regards

Snip3r

30/11/2008
19:16
Avatar
palobo
Portugal
Member
Members
Forum Posts: 41
Member Since:
13/11/2008
sp_UserOfflineSmall Offline

Hi, Please try the following and see if it wokrs:

seccao = rowdata.seccao;

30/11/2008
21:55
Avatar
snip3r05
Portugal
Member
Members
Forum Posts: 9
Member Since:
16/11/2008
sp_UserOfflineSmall Offline

i still have “undefined” in the alert     Frown

01/12/2008
03:24
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Here is the error:

You have

rowdata = jQuery(”#pagersg11″).getRowData(row_id);

should be

rowdata = jQuery(”#listsg11″).getRowData(row_id);

The method should be applied to grid, not to pager

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.

01/12/2008
08:38
Avatar
snip3r05
Portugal
Member
Members
Forum Posts: 9
Member Since:
16/11/2008
sp_UserOfflineSmall Offline

Thanks a lot tony

Best Regards

Snip3r

01/12/2008
10:32
Avatar
palobo
Portugal
Member
Members
Forum Posts: 41
Member Since:
13/11/2008
sp_UserOfflineSmall Offline

NIce catch... missed that one 😉

Cheers;
P.

03/12/2008
16:41
Avatar
snip3r05
Portugal
Member
Members
Forum Posts: 9
Member Since:
16/11/2008
sp_UserOfflineSmall Offline

Hi Again!

I have a new probl :S, i have a third grid inside of the grid i has having the probl retreiving the data. now i need to get the data  inside the second

grid into the the third but i dont now how to get the second grid name

so i can  allter this->>>>"rowdata = jQuery(”secondgrid name ″).getRowData(row_id);""

i tryed passing the  subgrid_table_id  as argument like this:

     subGridRowExpanded: function(subgrid_id, row_id,subgrid_table_id)

But the subgrid_table_id inside the expanded row is undified

Thanks in advanced

03/12/2008
16:50
Avatar
snip3r05
Portugal
Member
Members
Forum Posts: 9
Member Since:
16/11/2008
sp_UserOfflineSmall Offline

If it helps where is the code

   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 rowdata = jQuery("#listsg11").getRowData(row_id);
        var data = rowdata.data;
        unidade = rowdata.unidade;
        alert(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:'server.php',
            datatype: "json",
              colNames:['Id','id_seccao','id_unidade', 'Periodo', 'Seccao', 'Total Horas', 'Horas Extra'],
           colModel:[
            {name:'id',index:'id', width:55,hidden:true},
            {name:'seccao',index:'seccao', width:55,hidden:true},
            {name:'unidade',index:'unidade', width:55,hidden:true},
               {name:'data',index:'data', width:100},       
            {name:'seccao_desc',index:'seccao_desc', width:100},
               {name:'total',index:'total', width:80},
               {name:'extra',index:'extra', width:100}       
            ],
            mtype: "POST",
            postData:{q:7,unidade:uni,permissoes:perm,data:data,seccao:seccao,user:user},
               rowNum:20,
               pager: pager_id,
               imgpath: 'themes/basic/images',
               sortname: 'seccao',
              sortorder: "asc",
              height: '100%',
            width: 650,
              subGrid: true,
            subGridRowExpanded: function(subgrid_id, row_id,subgrid_table_id) {
                var row = jQuery("#"+subgrid_table_id).getRowData(row_id);
                var data = row.data;
                unidade = row.seccao;
                alert(subgrid_table_id);
            },

04/12/2008
12:53
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

maybe you should define variables before setting the grids

var subgrid, subsubgrid;

and set them accordantly, so that hey can be visible for

the grids

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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