Hi – I have two more questions which is taking more time to understand and resolve.
When I expand the Main jqGrid row I need to able to get the selected row column cell values and reset the subgrid navigation url’s(edit,add,delete etc..) by appending the select row column values as query string’s. So when an user edit’s a subgrid item or adds a new item to subgrid the controller should receive the column values from main grid row selected. I’m using subGridBeforeExpand event to capture main grid selected row data and modify subgrid navig properties like setting the edit, add etc url’s.
<script type="text/javascript">
function GetAndReset(id) {
//Not sure how to get selected row column values . I looked into online with various
examples of using getRowdata etc but nothing worked.
//Need to reset the subgrid navig edit,add,delete urls
jQuery("#ProfileSettingsEdit").jqGrid('navGrid', '#gridpager', {}, { url: url }, { url:
url }, {}, {}, {});
}
</script>
<div id="gridWrapper1" style="display: none">
@{
var grid1 = new JqGridHelper<Configuration.Models.Post.ProfileModel>(
"ServersWS",
caption: "Server Profiles With One or More Settings",
hidden: false,
hiddenEnabled: true,
dataType: JqGridDataTypes.Json,
methodType: JqGridMethodTypes.Post,
pager: true,
rowsNumber: 10,
sortingName: "Profile",
sortingOrder: JqGridSortingOrders.Asc,
url: Url.Action("GetServersWithSettings"),
subGridBeforeExpand: "function(id) {GetAndReset(id);}",
subgridEnabled: true,
subgridHelper: new JqGridHelper<PlatformConfigurationEditModel>(
"ProfileSettingsEdit",
caption: "Edit Settings",
hidden: false,
hiddenEnabled: true,
dataType: JqGridDataTypes.Json,
methodType: JqGridMethodTypes.Post,
pager: true,
rowsNumber: 10,
sortingName: "Id",
sortingOrder: JqGridSortingOrders.Asc,
url: Url.Action("GetEditableProfileSettings"),
editingUrl: Url.Action("Edit"),
viewRecords: true,
autoWidth: true,
sortable: true)
.Navigator(new JqGridNavigatorOptions { Search = false },
new JqGridNavigatorEditActionOptions { Url = Url.Action
("Update"),CloseAfterAdd = true, CloseAfterEdit = true, Width = 500, Height =
300 },
new JqGridNavigatorEditActionOptions { Url = Url.Action("Add"),
CloseAfterAdd = true, CloseAfterEdit = true, Width = 500, Height = 300 },
new JqGridNavigatorDeleteActionOptions { Url = Url.Action("Delete") },
null, new JqGridNavigatorViewActionOptions { LabelsWidth = "60%" }
)
.FilterToolbar(options: new JqGridFilterToolbarOptions
{
StringResult = true,
DefaultSearchOperator = JqGridSearchOperators.Cn,
AutoSearch = true,
SearchOnEnter = false
}),
sortable: true
).FilterToolbar(new JqGridFilterToolbarOptions
{
StringResult = true,
DefaultSearchOperator = JqGridSearchOperators.Cn,
AutoSearch = true,
SearchOnEnter = false,
});
@grid1.GetHtml()
}
</div>
Appreciate you help!.