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
Create/Update Grid using a Link from A different Grid
21/12/2010
18:16
Avatar
mrh
Member
Members
Forum Posts: 3
Member Since:
21/12/2010
sp_UserOfflineSmall Offline

Hi,

I have two functions that create two different grids on a page.  The first grid loads and has unique URLs which use an onclick function call to create another grid on the page.  This works very well for the first grid, however when I click on another URL from the first grid it does not reload the second grid with the new data.  I have tried variations of (reloadGrid) but it's just not working for me.

Essentially what I am trying to do is when a link is clicked in Grid 1 it updates Grid 2 with new data.  Your help is greatly appreciated.

Here are my functions.  The "buildTable1" function is called from a <body onload> event.  The "buildTable2" function is run when a link is clicked from Table 1 (and like I say, the first Table 2 grid is built fine, but not the others.

function buildTable1(idnum){
jQuery("#table1").jqGrid(
{
    url:'inc/tables.php?do=funct1&idnum='+idnum,
    datatype: "json",
    mtype: 'GET',
    colNames:['Manager Name','Division','Region','View Team'],
    colModel:[
                  {name:'name',index:'name', width:120, align:"center", search: false },
                  {name:'division_code',index:'division_code', width:90, align:"center", searchoptions: { sopt:['cn'] } },
                  {name:'region_code',index:'region_code', width:90, align:"center", searchoptions: { sopt:['cn'] } },
                  {name:'emp_id',index:'emp_id', width:70, align:"center",sortable: false, search: false }
    ],
    sortname: 'division_code',
    sortorder: "asc",
    rowNum:50,
    pager: '#table1-pager',
    viewrecords: true,
    caption:"Manager List North America",
    width: 399,
    height: 'auto' });
    jQuery("#table1").jqGrid('navGrid','#table1-pager',{
        edit:false,
        add:false,
        del:false });
}

My next function is like this which is called from a link in Table 1.

The link in Table 1 looks something like this. onclick="buildTable2(id);"

function buildTable2(id){
    jQuery("#table2").jqGrid( {
    
    url:'inc/tables.php?do=funct2&idnum='+idnum,
    datatype: "json",
    mtype: 'GET',
    colNames:['Name','ID','Division','Region','Phone'],
    colModel:[
                {name:'name',index:'name', width:120, align:"center", search: false },
                {name:'id',index:'id', width:70, align:"center",sortable: false, search: false },
                {name:'division_code',index:'division_code', width:90, align:"center", searchoptions: { sopt:['cn'] } },
                {name:'region_code',index:'region_code', width:90, align:"center", searchoptions: { sopt:['cn'] } },
                {name:'phone_number',index:'phone_number', width:120, align:"center", search: false }
],
    sortname: 'name',
    sortorder: "asc",
    rowNum:50,
    pager: '#table2-pager',
    viewrecords: true,
    caption:"Team List",
    width: 680,
    height: 'auto' });
    jQuery("#table2").jqGrid('navGrid','#table2-pager',{
        edit:false,
        add:false,
        del:false });
        
}

I like to put my filters as links in the tables which will then reload the data.  I used to do this purely in PHP but I wanted to start using JQGRID so I am evaluating this but stuck at this point.

Thanks

21/12/2010
19:09
Avatar
mrh
Member
Members
Forum Posts: 3
Member Since:
21/12/2010
sp_UserOfflineSmall Offline

I have tried using the .trigger("reloadGrid") method but still only the first table 2 is loaded.  Subsequent link clicks does not reload the tbale with new data.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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