Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 797761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:51:37+00:00 2026-05-14T22:51:37+00:00

I am using jqgrid. My page has three tabs and each tab contains a

  • 0

I am using jqgrid. My page has three tabs and each tab contains a different grid. All grids have different ids. The content of tabs is fetched via AJAX request lazily. Now after all three grids are rendered and I try to reload grid via function

jQuery("#myOffersTable").trigger('reloadGrid'); 

Only the grid which loaded last reloads and it doesn’t work for other grids.

For example, if grids load seq is : 1-2-3 then this code will only work for grid 3
but if seq is 3-2-1 then it will work only for 1.

But if I try reloading grids using reload button on navigator bar it works fine.

Update:

I am using Struts2 jQuery Plugin.It uses jqGrid 3.6.4
I load json data using ajax.

Below is the definition of my grid.

<div id='t1'>
    <s:url id="offersurl" action="offers"/>
     
    <sjg:grid 
        id="offerstable" 
        caption="Customer Examples"
        autoencode="false" 
        dataType="json" 
        href="%{offersurl}"         
        
        pager="true"       
        navigator="true"
        navigatorAdd="false"
        navigatorDelete="false"
        navigatorEdit="false"
        navigatorSearch="false"
                
        gridModel="offers"
        rowList="10,15,20"
        rowNum="15"
        rownumbers="true"
        onCompleteTopics="addAcceptButtons"
        filter="true"
    >
        <sjg:gridColumn name="id" index="id" title="ID" formatter="integer" sortable="false" search="false"/>
        <sjg:gridColumn name="offeror" index="offeror" title="Offeror" sortable="true" search="false"/>
        <sjg:gridColumn name="itemOffered" index="itemOffered" title="ItemOffered" sortable="false" search="true" searchoptions="{sopt:['eq']}"/>
        <sjg:gridColumn name="quantityOffered" index="quantityOffered" title="QuantityOffered" sortable="false" search="true" searchoptions="{sopt:['eq','lt','gt']}"/>
        <sjg:gridColumn name="expectedItem" index="expectedItem" title="ExpectedItem" sortable="false" search="true" searchoptions="{sopt:['eq']}"/>
        <sjg:gridColumn name="expectedQuantity" index="expectedQuantity" title="ExpectedQuantity" sortable="false" search="true" searchoptions="{sopt:['eq','lt','gt']}"/>
        <sjg:gridColumn name="acceptOffer" index="acceptOffer"  title="Accept Offer" search="false"/>
    </sjg:grid>    
    
</div>

I have three such grids all have different ids and all that stuff.

There is a search button above each grid which calls the following function with parameter sel.sel is 1,2 or 3 corresponding to each grid

function search(sel)
{   
    alert("search");
    if(sel==1)
    {       
        tradeOffer = $("#games").val();
        var srchValue = $("#srchoptions").val();
            $.ajaxSetup({
                data: {'gameId': tradeOffer},             
            });
        jQuery("#offerstable").jqGrid('setGridParam',{url:"offers.action?q=1&srch="+srchValue,page:1});
        //jQuery("#offerstable").trigger('reloadGrid');
        $("#offerstable").trigger("reloadGrid");
    }
    else if(sel==2)
    {           
            myTradeOfferGame = $("#my").val();          
                $.ajaxSetup({
                    data: {'gameId': myTradeOffer},               
                });
            jQuery("#myOffersTable").jqGrid('setGridParam',{url:"offers.action?q=1",page:1});
            jQuery("#myOffersTable").trigger('reloadGrid');                 
    }
    else if(sel==3)
    {           
            acceptedTradeOfferGame = $("#accepted").val();          
                $.ajaxSetup({
                    data: {'gameId': acceptedTradeOffer},             
                });
            jQuery("#acceptedtable").jqGrid('setGridParam',{url:"offers.action?q=1",page:1});
            jQuery("#acceptedtable").trigger('reloadGrid');                 
    }
    
}

The function gets called for each grid but

jQuery("#acceptedtable").trigger('reloadGrid'); 

works for only grid loaded last.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:51:38+00:00Added an answer on May 14, 2026 at 10:51 pm

    First of all in your code you define variables myTradeOfferGame and acceptedTradeOfferGame (inside of else if(sel==2) and else if(sel==3)), but use myTradeOffer and acceptedTradeOffer. It looks like errors.

    Second: The urls inside of else if(sel==2) and else if(sel==3) look another as in the first table: URLs are static, so why one should set this value every time? Probably you want to add in all urls the part with $("#srchoptions").val()? You should fix these problem yourself.

    In your code one can see, that you use $.ajaxSetup which change global settings of $.ajax. If you change this 3 times only the last one will be saved. If only one from three setting work at one refresh, $.ajaxSetup is nevertheless not the best way. jqGrid has parameter ajaxGridOptions, which set parameters of $.ajax per table (see Setting the content-type of requests performed by jQuery jqGrid).

    Moreover jqGrid (every instance) has a parameter postData, which will be forward to $.ajax as data parameter. So you can use this parameter in the jqGrid definition. If you want that the data which you place as postData will be reloaded during every trigger('reloadGrid') you can just define postData using function. The default behavior of $.ajax is to test whether the field of data parameter is function, it it is so, $.ajax call this function the get the value. So your code could look like following:

    // definition of 3 jqGrids
    jQuery("#offerstable").jqGrid ({
        postData: {'gameId': function() { return $("#games").val(); } },
        //...
    });
    jQuery("#myOffersTable").jqGrid ({
        postData: {'gameId': function() { return $("#my").val(); } },
        //...
    });
    jQuery("#myOffersTable").jqGrid ({
        postData: {'gameId': function() { return $("#accepted").val(); } },
        //...
    });
    
    if(sel==1)
    {       
        jQuery("#offerstable")
        .jqGrid('setGridParam',
                {url:"offers.action?q=1&srch="+encodeURIComponent($("#srchoptions").val()),
                page:1})
        .trigger('reloadGrid');
    } else //...
    // ...
    

    By the way if you use HTTP GET for data request, the parameters from data parameter (postData) will be just appended to the url (with placing ‘?’ and ‘&’ like one do this usual).

    The final code can be something like following:

    // definition of 3 jqGrids
    jQuery("#offerstable").jqGrid ({
        url:"offers.action", 
        postData: {'q': 1,
                   'gameId': function() { return $("#games").val(); },
                   'srch': function() { return $("#srchoptions").val(); },
        //...
    });
    jQuery("#myOffersTable").jqGrid ({
        url:"offers.action", 
        postData: {'q': 1,
                   'gameId': function() { return $("#my").val(); } },
        //...
    });
    jQuery("#myOffersTable").jqGrid ({
        url:"offers.action", 
        postData: {'q': 1,
                   'gameId': function() { return $("#accepted").val(); } },
        //...
    });
    

    and

    if(sel==1) {
        jQuery("#offerstable").jqGrid('setGridParam',{page:1}).trigger('reloadGrid');
    } else if (sel==2) {
        jQuery("#myOffersTable").jqGrid('setGridParam',{page:1}).trigger('reloadGrid');
    } else if (sel==3) {
        jQuery("#acceptedtable").jqGrid('setGridParam',{page:1}).trigger('reloadGrid');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a asp.net webforms page in which I'm using the jqGrid component. The
Greetings, I have a problem using jqgrid and jquery tab (I am coding in
Hi I'm using jqgrid to show some information in a grid. But I have
I am newbie in using jqgrid. While new page load the grid is properly
i have an asp.net-mvc web page and i am using jqgrid on the front
How can I find the current page number in jqGrid (using jQuery of course).
I have a project in ASP.NET MVC1 using VB.NET controlers and JqGrid. it works
I'm using jqGrid to build a custom inline entry widget on a page. The
I'm using jqGrid in an ASP.NET MVC webapp. When the page first loads, the
I have a Jqgrid which has datatype as local. I am loading data at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.