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 942535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:17:16+00:00 2026-05-15T22:17:16+00:00

Is it possible to add data to a subgrid when the data type for

  • 0

Is it possible to add data to a subgrid when the data type for the parent jqgrid is of type clientSide?

I am able to add a row to the parent jqgrid using:

jQuery("#myId").addRowData(0, someRowData);

But i’m not to sure how I would add data to the subgrid. Any ideas?

  • 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-15T22:17:17+00:00Added an answer on May 15, 2026 at 10:17 pm

    I wasn’t able to identify how to actually add data to a subgrid of jqGrid, but I was able to add data to a grid within another grid.

    My master grid looks like:

    $("#" + tblNm).jqGrid({
                    datatype: "local",
                    colNames: ['id', 'Last Name', 'First Name', 'Address'],
                    colModel: [{
                        name: 'id',
                        index: 'id',
                        width: 75,
                        sortable: false
                    }, {
                        name: 'lastNm',
                        index: 'lastNm',
                        width: 90,
                        sortable: false
                    }, {
                        name: 'firstNm',
                        index: 'firstNm',
                        width: 100,
                        sortable: false
                    }, {
                        name: 'address',
                        index: 'address',
                        width: 200,
                        align: "left",
                        sortable: false
                    }],
                    width: "100%",
                    height: "100%",
                    caption: "Clients",
                    jsonReader: {
                        root: "clients",
                        page: "currpage",
                        total: "totalpages",
                        records: "totalrecords",
                        repeatitems: false,
                        id: "id"
                    },
                    subGrid: true,
                    subGridRowExpanded: function(subgrid_id, row_id){
                        console.debug("SubGrid_ID:  " + subgrid_id +
                        "   / row_id:  " +
                        row_id);
                        var subgrid_table_id, pager_id;
                        subgrid_table_id = "mySubGridName" + row_id;
                        pager_id = "p_" + subgrid_table_id;
                        $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "'></table>");
                        jQuery("#" + subgrid_table_id).jqGrid({
                            datatype: "local",
                            colNames: ['Order Id', 'Item Name', 'Cost'],
                            colModel: [{
                                name: "ordId",
                                index: "ordId",
                                width: 20,
                                key: true
                            }, {
                                name: "itemName",
                                index: "itemName",
                                width: 130
                            }, {
                                name: "cost",
                                index: "cost",
                                width: 200,
                                align: "left"
                            }],
                            rowNum: 20,
                            caption: "Orders",
                            height: '100%',
                            width: '100%',
                            jsonReader: {
                                root: "orders",
                                page: "currpage",
                                total: "totalpages",
                                records: "totalrecords",
                                repeatitems: false,
                                id: "num"
                            }
                        });
                    }
                });
    

    I load the master grid by doing something like:

    $("#" + tblNm)[0].addJSONData(wrapper);
    

    Then when I get the subgrid data I do something like:

     // click on the subgrid so that the table is added to the DOM
     // I think there are better ways of doing this... you'll want to look @ the jqGrid documentation
     $("#" + masterTblId + " tr[id='1'] td[role='grid'] a span").click();
     // add the data to the subgrid
     $("#" + subGridId)[0].addJSONData(wrapper);
    

    The most important parts are defining the code in the subgridexpanded property of jqGrid and then being able to force the subgrid to display.

    The only problem with this method is that if the user clicks on the subgrid area then it is toggled and when they click on it again it doesn’t show back up properly. I have asked the community about how to fix that here:

    Subgrid Caching or Stopping Subgrid data from being removed (jqGrid)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 468k
  • Answers 468k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As explained in the Hamcrest tutorial, the Factory annotation is… May 16, 2026 at 2:28 am
  • Editorial Team
    Editorial Team added an answer The "tailing" slash at the end is escaping the double… May 16, 2026 at 2:28 am
  • Editorial Team
    Editorial Team added an answer You can subclass the ABC (abstract base class) collections.Mapping (or… May 16, 2026 at 2:28 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.