如何在MVC中选择JQGrid的selectedrow名称值 [英] How to select the selectedrow name value of JQGrid in MVC
本文介绍了如何在MVC中选择JQGrid的selectedrow名称值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码.我认为:
Hi,
I have the following code. In my view:
$(document).ready(function () {
$("#ListOfPeople").jqGrid({
url: '/Absence/PeopleList/',
datatype: 'json',
type: 'GET',
// mtype: 'POST',
// postData: {
// PersonRoleKey: @*@Model.personviewmodel.id*@
// },
colNames: ['Name'],
colModel: [
{ name: 'Name', index: 'Name', width: 200, align: 'center', sortable: true, editable: false }
],
rowNum: 10,
sortname: 'Name',
sortorder: 'asc',
caption: 'List of People',
hiddengrid: false,
pager: '#nameofpeoplestoolbar',
pgbuttons: true,
pginput: false,
scroll: true,
scrollOffset:1,
autowidth:true,
sortable: true, // This and following line sorts the data
loadonce: true,
viewrecords:true
});
});
如何获得Selected JQGrid ID并将其传递给控制器,该控制器根据传递的值显示数据?
谢谢
How can I get the Selected JQGrid ID to pass it it to a controller where it dispalys the data based on the passed value?
Thank you
推荐答案
(文档).ready(功能(){
(document).ready(function () {
(" ).jqGrid({ 网址:' /Absence/PeopleList/', 数据类型:' json', 类型:' GET', // mtype:'POST', // postData:{ // PersonRoleKey:@ * @ Model.personviewmodel.id * @ // }, colNames:[' 名称'], colModel:[ {名称:' 名称',索引:' 名称',宽度: 200 ,对齐:' 居中',可排序: true ,可 false } ], rowNum: 10 , 排序名称:' 名称', 排序顺序:' asc', 标题:' 人员名单, hiddengrid: false , 传呼机:' #nameofpeoplestoolbar', pgbuttons: true , pginput: false , 滚动:真, scrollOffset: 1 , 自动宽度:真, sortable: true ,// 数据 loadonce: true , viewrecords:为真 }); });
("#ListOfPeople").jqGrid({ url: '/Absence/PeopleList/', datatype: 'json', type: 'GET', // mtype: 'POST', // postData: { // PersonRoleKey: @*@Model.personviewmodel.id*@ // }, colNames: ['Name'], colModel: [ { name: 'Name', index: 'Name', width: 200, align: 'center', sortable: true, editable: false } ], rowNum: 10, sortname: 'Name', sortorder: 'asc', caption: 'List of People', hiddengrid: false, pager: '#nameofpeoplestoolbar', pgbuttons: true, pginput: false, scroll: true, scrollOffset:1, autowidth:true, sortable: true, // This and following line sorts the data loadonce: true, viewrecords:true }); });
如何获得Selected JQGrid ID并将其传递给控制器,该控制器根据传递的值显示数据?
谢谢
How can I get the Selected JQGrid ID to pass it it to a controller where it dispalys the data based on the passed value?
Thank you
尝试以下功能
Try following function
function getSelectedRow() {
var grid = jQuery("#JQGrid1");
var rowKey = grid.getGridParam("selrow");
if (rowKey)
alert("Selected row primary key is: " + rowKey);
else
alert("No rows are selected");
}
要获取更多帮助,请找到此链接有用.
HTH
For more help find this link useful.
HTH
这篇关于如何在MVC中选择JQGrid的selectedrow名称值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文