[英]How do i get the expanded jqGrid row column data
When Main jqGrid row is expanded a subgrid is constructed and displayed. 展开Main jqGrid行时,将构造并显示子网格。 I need to capture main grid expanded row column data before subgrid is constructed.
我需要在构造子网格之前捕获主网格扩展的行列数据。 For that i'm using subGridBeforeExpand event of Main Grid.
为此,我正在使用主网格的subGridBeforeExpand事件。 In that event the i'm calling a javascript code to capture expanded row column data but with out any success .
在那种情况下,我正在调用一个javascript代码来捕获扩展的行列数据,但没有任何成功。 alert throws sel_id as null .
alert将sel_id抛出为null 。 Could any one guide me on this?.
任何人都可以指导我吗? Do i need to use another grid event or something wrong with my jquery code?.
我需要使用另一个网格事件或我的jquery代码有什么问题吗?
**<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>
I am not familiar with Lib.Web.Mvc library, but you can try to use jQuery events instead of callbacks . 我不熟悉Lib.Web.Mvc库,但您可以尝试使用jQuery事件而不是回调 。 For example
jqGridSubGridBeforeExpand
could be what you need: 例如,
jqGridSubGridBeforeExpand
可能是您所需要的:
jQuery("#ServersWS").bind("jqGridSubGridBeforeExpand", function (e, pID, rowid) {
alert("rowid=" + rowid);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.