如何在MVC中选择JQGrid的selectedrow名称值

编程入门 行业动态 更新时间:2024-10-26 01:18:56
本文介绍了如何在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 () {

(" #ListOfPeople" ).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名称值

本文发布于:2023-10-30 18:57:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1543713.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:名称   如何在   JQGrid   MVC   selectedrow

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!