JQGrid subgrid Url: Is it possible to change the value of ?Id=id


I'm trying to implement a JqGrid with a subgrid as so...

     jQuery(document).ready(function() {
                    url: '/OrganizationalUnit/FindAll/',
                    datatype: 'json',
                    mtype: 'GET',
                    colNames: ['Name', 'Actions'],
                    colModel: [ 
                      { name: 'Name', index: 'Name', width: 500, align: 'left' },                  
                      { name:'act', index:'act', width:250,sortable:false}


                        subGrid : true, 
                        subGridUrl: '/OrganizationalUnit/Organizations/', 
                          { name: 'Name', index: 'Name', width: 300, align: 'left' },
                          { name: 'OrganizationID', index: 'OrganizationID', width: 300, align: 'left' }                   


So the way JqGrid works is that when the controller method for OrganizationalUnitController.Organizations gets called, a query string of "?id=4" gets appended to the URL. M problem is that the "4" is just an arbitrary row number that JqGrid has created for the grid and doesn't provide me with an identifier for the OrganizationalUnit the I trying to retreive a subgrid for. So what I'm wondering is it there is any way that I can assign the 'name' value to the id argument?

Has anyone figured this out before?

By : matt_dev


Where exactely did you put the params parameter?

I am surprised that your defintion of the subGridModel actually works. Since the manual recommends a different structure:

  subGridModel : [ 
  name  : ['No', 'Item', 'Qty', 'Unit', 'Line Total'],
  width : [55, 200, 80, 80, 80],
  align : ['left','left','right','right','right'],
  params: ['invdate'] 

wiki:subgrid - jqGrid Wiki

Ok...I have figured it out.

If I add the params: ['name'] arguement to the subGridModel definition then I can get the value of the OrganizationalUnit name through the HttpContext.Request.Params collection.

By : matt_dev

This video can help you solving your question :)
By: admin