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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:43:20+00:00 2026-05-25T11:43:20+00:00

I faced a critical problem with jqGrid today. Let’s explain my problem first. I

  • 0

I faced a critical problem with jqGrid today. Let’s explain my problem first.

I have a main grid which contains the following columns:

Scholarship Name .................................. Student Type
-----------------------------------------------------------------
Full Free Studentship ............................. Poor   
Sir Alfred Nobel Scholarship ...................... Meritorious   
Taj Uddin Memorial Scholarship .................... Individual 

Now I need a sub-grid of this main grid. Student Type is a select type column. When user choose Poor for the Student Type column and click on sub-grid icon then the following sub-grid will be shown:

Guardian Income Range Start Value ....................... Range End Value
--------------------------------------------------------------------------
0 ....................................................... 5000   
5001 .................................................... 10000

When user choose Meritorious then a different sub-grid will be shown which is as follows:

Merit Start .................. Merit End
----------------------------------------
1 ............................ 7

And Individual shows the following:

Student ID
----------
115588   
225577   
336699 

My Question:

Is it possible in jqGrid or any other simple way to implement this.

Thanks in advance.

  • 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-25T11:43:21+00:00Added an answer on May 25, 2026 at 11:43 am

    I’ve found that if you use SubGridRowExpanded and subGridRowColapsed to build the subgrid that you can generate completely different subgrids based upon the row that was expanded.

    Below I’ve included a modification of the GridAsSubGrid example at JQGrid Here it simply looks at the ID of the row being expanded, and if its a special case (id=12345) it displays a special grid. You could filter yours based on the student type and show a grid accordingly.

    I am using addRowData to add the information, I haven’t tested other data binding methods.

    <script type="text/javascript">
    var lastsel2;
    $(document).ready(function(){
        jQuery("#rowed5").jqGrid({
            datatype: "local",
            height: 250,
            colNames:['ID Number','Name', 'Stock', 'Ship via','Notes'],
            colModel:[
                {name:'id',index:'id', width:90, sorttype:"int", editable: true},
                {name:'name',index:'name', width:150,editable: true,editoptions:{size:"20",maxlength:"30"}},
                {name:'stock',index:'stock', width:60, editable: true,edittype:"checkbox",editoptions: {value:"Yes:No"}},
                {name:'ship',index:'ship', width:90, editable: true,edittype:"select",editoptions:{value:"FE:FedEx;IN:InTime;TN:TNT;AR:ARAMEX"}},       
                {name:'note',index:'note', width:200, sortable:false,editable: true,edittype:"textarea", editoptions:{rows:"2",cols:"10"}}      
            ],
            onSelectRow: function(id){
                if(id && id!==lastsel2){
                    jQuery('#rowed5').jqGrid('restoreRow',lastsel2);
                    jQuery('#rowed5').jqGrid('editRow',id,true);
                    lastsel2=id;
                }
            },
            editurl: "server.php",
            caption: "Input Types",
            multiselect: false,
            subGrid: true,
            subGridRowExpanded: function(subgrid_id, row_id){
                var subgrid_table_id;
                subgrid_table_id = subgrid_id+"_t";
                $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'>");
    
                if(row_id != "12345") {
                    jQuery("#"+subgrid_table_id).jqGrid({
                        datatype: "local",
                        colNames: ['No','Item','Qty','Unit','Line Total'],
                        colModel: [
                            {name:"num",index:"num",width:80},
                            {name:"item",index:"item",width:130},
                            {name:"qty",index:"qty",width:70,align:"right"},
                            {name:"unit",index:"unit",width:70,align:"right"},
                            {name:"total",index:"total",width:70,align:"right",sortable:false}
                        ],
                        rowNum:20,
                        sortname: 'num',
                        sortorder: "asc",
                        height: '100%'
                    });
    
                    var tdata = [ 
                            { num:"123", item:"single item", qty:"1", unit:"£1.00", total:"£1.00"}, 
                            { num:"234", item:"multi item", qty:"2", unit:"£1.00", total:"£2.00"},
                        ];
    
                    for(var i=0;i < tdata.length;i++)
                        jQuery("#"+subgrid_table_id).jqGrid('addRowData',subgrid_table_id+"r"+tdata[i].num,tdata[i]);
                } else {
                    jQuery("#"+subgrid_table_id).jqGrid({
                        datatype: "local",
                        colNames: ['No','Error Message'],
                        colModel: [
                            {name:"num",index:"num",width:80},
                            {name:"error",index:"item",width:250},
                        ],
                        rowNum:20,
                        sortname: 'num',
                        sortorder: "asc",
                        height: '100%'
                    });
    
                    var tdata = [ 
                            { num:"1", error:"not validated"}, 
                            { num:"2", error:"only available on thursdays"},
                        ];
    
                    for(var i=0;i < tdata.length;i++)
                        jQuery("#"+subgrid_table_id).jqGrid('addRowData',subgrid_table_id+"r"+tdata[i].num,tdata[i]);
                }
            },
            subGridRowColapsed: function(subgrid_id, row_id){
                var subgrid_table_id;
                subgrid_table_id = subgrid_id+"_t";
                jQuery("#"+subgrid_table_id).remove();
            }
    
        });
        var mydata2 = [
                {id:"12345",name:"Desktop Computer",note:"note",stock:"Yes",ship:"FedEx"},
                {id:"23456",name:"Laptop",note:"Long text ",stock:"Yes",ship:"InTime"},
                {id:"34567",name:"LCD Monitor",note:"note3",stock:"Yes",ship:"TNT"},
                {id:"45678",name:"Speakers",note:"note",stock:"No",ship:"ARAMEX"},
                {id:"56789",name:"Laser Printer",note:"note2",stock:"Yes",ship:"FedEx"},
                {id:"67890",name:"Play Station",note:"note3",stock:"No", ship:"FedEx"},
                {id:"76543",name:"Mobile Telephone",note:"note",stock:"Yes",ship:"ARAMEX"},
                {id:"87654",name:"Server",note:"note2",stock:"Yes",ship:"TNT"},
                {id:"98765",name:"Matrix Printer",note:"note3",stock:"No", ship:"FedEx"}
                ];
        for(var i=0;i < mydata2.length;i++)
            jQuery("#rowed5").jqGrid('addRowData',mydata2[i].id,mydata2[i]);
    });
    </script>
    <table id="rowed5"></table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I faced an interesting problem as... I have MSSQL (2005) table A which contains
I faced a problem today which has happened to me several times before. I
Ive faced a problem which I have no idea the why ... so Im
I faced a problem while using threading for the first time, In an SWT
I have faced this problem quite often during the last couple of months, during
I am currently faced with a difficult sorting problem. I have a collection of
I faced a following problem: generate N unique alphanumeric strings from a restricted alphabet.
i have faced this problem couple of days ago, while trying to import an
I faced a problem using a Boost variant. I have a segmentation fault when
Recently I've faced such problem. I'm working on the application, in which logging is

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.