I have a simple jqgrid
@(Html.Grid("something")
.SetCaption("")
.AddColumn(new Column("ID").SetHidden(true))
.AddColumn(new Column("Name").SetLabel("Name").SetSearch(true))
.SetUrl(Url.Action(something))
)
I have var SomeOtherID = 2
in javascript.
I need to add this SomeOtherID to filter parameters when grid loads (in fact there is many grids on same page and they all need this) without loosing default seatch capability. I suspect I need add this function on .OnBeforeRequest("addSomeOtherID()")
but what to do inside
function addSomeOtherID(grid)
{
var pd = grid.getGridParams("postData");
?????? here I need to add SomeOtherID to postData filters
grid.setGridParams({postData: pd});
}
Solution was simple. As I suspected .OnBeforeRequest("addSomeOtherID(grid)") did the trick.