When Main jqGrid row is expanded a subgrid is constructed and displayed. I need to capture main grid expanded row column data before subgrid is constructed. For that i'm using subGridBeforeExpand event of Main Grid. In that event the i'm calling a javascript code to capture expanded row column data but with out any success . alert throws sel_id as null. Could any one guide me on this?. Do i need to use another grid event or something wrong with my jquery code?.
**<script type="text/javascript">
function GetValues() {
var sel_id = jQuery("#ServersWS").jqGrid('getGridParam', 'selrow');
alert(sel_id);
var rowData = jQuery("#ServersWS").jqGrid('getRowData', sel_id);
var temp = rowData['Description']; //replace name with you column
alert(temp);
}
</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) {GetValues();}",**
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>