Add "params" to subGridModel when using Lib.Web.Mvc

62 Views Asked by At

There doesn't appear to be any way to set a value for subGridModel params when using JqGridSubGridModel in Lib.Web.Mvc. I'm trying to use this to include a property from the main grid as an additional parameter on the subGridUrl.

As a solution I'm trying to set this value using JavaScript after the script generated by Lib.Web.Mvc executes. I'm not getting any errors, but I'm also not getting the additional parameter passed. I've creating the grid using:

var grid = new JqGridHelper<...>(
    "yourGridId",
    ...
);

and the actual JavaScript I'm using is:

@grid.GetJavaScript();

var subGridModelObject = $("#yourGridId").jqGrid("getGridParam", "subGridModel");
subGridModelObject.params = [ "AdditionalValue" ];
$("#yourGridId").jqGrid("setGridParam", { subGridModel: subGridModelObject }).trigger("reloadGrid");

The subGrid executes the url but only passes the rowId value without the additional value.

Thanks.

1

There are 1 best solutions below

0
On

First of all you do not need to reload the grid after setting this parameter.

Second the other jqGrid code is missing which make the process of solving the problem very difficult.

Is the "AdditionalValue" a name from colModel? If this value does not correspond to a name of colModel it will not be posted.

The params object works only in a "pure" subgrid - this mean if you have defined a event subGridRowExpanded, the params value does not have effect