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

  • Home
  • SEARCH
  • 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 8787889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:00:35+00:00 2026-06-13T22:00:35+00:00

I want to use jqgrid with nested subgrids. However, the only examples I’ve found

  • 0

I want to use jqgrid with nested subgrids. However, the only examples I’ve found populate the main grid with one url load-data call and separate calls to populate the subgrids.

My subgrid data exist as nested documents in one JSON structure, as shown in the snippet below (I want chapters to appear as subgrids of the book, and files to be subgrids within chapters).

Can I create subgrids from nested JSON documents with jqgrid?

{
  _id: {"509403957ae7d3929edcb812"},
  name: {"MYBOOK"},
  layout: {
        chapters [
           {
              name: "myfirstchapter",
              sequence: 1,
              title: "My First Chapter",
              files: [
                 {
                 filetype: "tex",
                 name: "myfirstfile"
                 },
                 {
                 filetype: "tmpl",
                 name: "myfileb",
                 }
              ],

           },
           {
              name: "mysecondchapter",
              sequence: 2,
              title: "My Second Chapter",
              files: [
                 {
                 filetype: "tex",
                 name: "myintro"
                 },
                 {
                 filetype: "tex",
                 name: "myfilec",
                 }
              ],

           ],
        }
}
  • 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-06-13T22:00:36+00:00Added an answer on June 13, 2026 at 10:00 pm

    I made the demo which demonstrate how to do this:

    enter image description here

    The demo are based on the idea described here and on the fact that internal data option saves the input data in unmodified form. So you don’t need to create some hidden columns to save additional information associated with the row. See the answer and this one for more details. I strictly recommend you additionally to use idPrefix option in subgrids. See the answer for details.

    Below in the code which I used in the demo:

    var myData = {
            _id: "509403957ae7d3929edcb812",
            name: "MYBOOK",
            layout: {
                chapters: [
                    {
                        name: "myfirstchapter",
                        sequence: 1,
                        title: "My First Chapter",
                        files: [
                            { filetype: "tex", name: "myfirstfile" },
                            { filetype: "tmpl", name: "myfileb" }
                        ]
                    },
                    {
                        name: "mysecondchapter",
                        sequence: 2,
                        title: "My Second Chapter",
                        files: [
                            { filetype: "tex", name: "myintro" },
                            { filetype: "tex", name: "myfilec" }
                        ]
                    }
                ]
            }
        },
        $grid = $("#list");
    
    $grid.jqGrid({
        datatype: "local",
        data: myData.layout.chapters,
        colNames: ["Sequence", "Name", "Title"],
        colModel: [
            {name: "sequence", width: 65, key: true },
            {name: "name", width: 150 },
            {name: "title", width: 150}
        ],
        rowNum: 10,
        rowList: [5, 10, 20],
        pager: "#pager",
        gridview: true,
        ignoreCase: true,
        rownumbers: true,
        sortname: "sequence",
        viewrecords: true,
        height: "100%",
        subGrid: true,
        subGridRowExpanded: function (subgridId, rowid) {
            var subgridTableId = subgridId + "_t";
            $("#" + subgridId).html("<table id='" + subgridTableId + "'></table>");
            $("#" + subgridTableId).jqGrid({
                datatype: "local",
                data: $(this).jqGrid("getLocalRow", rowid).files,
                colNames: ["Name", "Filetype"],
                colModel: [
                  {name: "name", width: 130, key: true},
                  {name: "filetype", width: 130}
                ],
                height: "100%",
                rowNum: 10,
                sortname: "name",
                idPrefix: "s_" + rowid + "_"
            });
        }
    });
    $grid.jqGrid("navGrid", "#pager", {add: false, edit: false, del: false});
    

    In the above code I fixed some syntax errors from the data which you posted.

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

Sidebar

Related Questions

I am using jQuery 1.6.1 and want to use JqGrid (a grid table plugin
I want to use a grid as subgrid in jqGrid because I read that
I am looking to have a very simple grid and i want to use
I use jqGrid to epose some big Tree. Now I want to remember expanded
I am use jqGrid. I want to add record inline navigation so this link
I don't want use ajax to load data in my grid. Theres a way
I have a jqGrid on an ASP.Net MVC view. I want to use to
Is it possible to group in jqgrid without using subgrids ? I just want
Found the documentation here http://www.trirand.com/jqgridwiki/doku.php?id=wiki:toolbar_searching I want JQgrid filterToolbar blank top row in the
I Use JqGrid jquery plugin, i Want to use insert popup Capability, but I'll

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.