如何在JQGrid中获取行中特定单元格的值?
我是JQGrid的新手。我创建了一个表,其中每一行都包含一个编辑按钮。我想在单击“编辑”按钮时,通过选择特定行向控制器发送一个值。我找了几个答案,但不太明白。我想在UpdateRow函数中发送数据。 这是我的jq网格代码如何在JQGrid中获取行中特定单元格的值?,jqgrid,jqgrid-asp.net,Jqgrid,Jqgrid Asp.net,我是JQGrid的新手。我创建了一个表,其中每一行都包含一个编辑按钮。我想在单击“编辑”按钮时,通过选择特定行向控制器发送一个值。我找了几个答案,但不太明白。我想在UpdateRow函数中发送数据。 这是我的jq网格代码 var Integrate = function() { function GetValue() { $(function (){ $("#tblSelectIntegrations").jqGrid({ mtype: &
var Integrate = function() {
function GetValue() {
$(function (){
$("#tblSelectIntegrations").jqGrid({
mtype: "GET",
url: "/Integrations/Detail",
datatype: "json",
async: false,
colNames: [
"ID","First Name", "Email Address","Edit"
],
colModel: [
{ key: false, name: "IntegrationId", index: "IntegrationId", editable: false, width: 200, hidden:true },
{ key: false, name: "IntegrationName", index: "IntegrationName", editable: false, width: 200, hidden:false },
{ key: false, name: "CompanyEmail", index: "CompanyEmail", editable: false, width: 200, hidden:false },
{
name: '',
key: false,
width: 25,
editable: true,
sortable: false,
formatter: function () {
return "<button type='button' data-toggle='modal' data-target='#exampleModalCenter' onclick='Integrate.UpdateRow.call(this, event)' class='fm-button ui-state-default ui-corner-all noPrint'><span class='ui-icon ui-icon-pencil'></span></button>";
}
}
],
pager: jQuery("#divSelect"),
rowNum: -1,
scroll: 0,
height: $(window).innerHeight() - 450,
width: "100%",
viewrecords: true,
caption: "Product",
emptyrecords: "No records to display",
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
Id: "0"
},
autowidth: true,
multiselect: false,
loadonce:true,
autoencode: true,
ajaxGridOptions: { cache: false }
}).navGrid("tblSelectIntegrations", { edit: false, add: false, del: false, search: false, refresh: false });
});
}
function UpdateRow() {
var appOrderId = $(this).closest("tr.jqgrow").attr("id");
ShowControls("/Integrations/Update/" + appOrderId);
}
return {
GetValue: GetValue,
UpdateRow:UpdateRow
}
}();
var Integrate=function(){
函数GetValue(){
$(函数(){
$(“#tblselectionintegrations”).jqGrid({
mtype:“获取”,
url:“/Integrations/Detail”,
数据类型:“json”,
async:false,
姓名:[
“ID”、“名字”、“电子邮件地址”、“编辑”
],
colModel:[
{key:false,name:“IntegrationId”,index:“IntegrationId”,可编辑:false,宽度:200,隐藏:true},
{key:false,name:“IntegrationName”,index:“IntegrationName”,可编辑:false,宽度:200,隐藏:false},
{key:false,名称:“CompanyEmail”,索引:“CompanyEmail”,可编辑:false,宽度:200,隐藏:false},
{
名称:“”,
关键:错,
宽度:25,
是的,
可排序:false,
格式化程序:函数(){
返回“”;
}
}
],
寻呼机:jQuery(“#divSelect”),
rowNum:-1,
滚动:0,
高度:$(窗口).innerHeight()-450,
宽度:“100%”,
viewrecords:是的,
标题:“产品”,
emptyrecords:“没有要显示的记录”,
jsonReader:{
根:“行”,
第页:“第页”,
总计:“总计”,
记录:“记录”,
重复项:false,
Id:“0”
},
自动宽度:正确,
多选:错,
有一次:是的,
自动编码:正确,
ajaxGridOptions:{cache:false}
}).navGrid(“tblSelectIntegrations”,{edit:false,add:false,del:false,search:false,refresh:false});
});
}
函数UpdateRow(){
var-appOrderId=$(this).closest(“tr.jqgrow”).attr(“id”);
ShowControls(“/Integrations/Update/”+appOrderId);
}
返回{
GetValue:GetValue,
UpdateRow:UpdateRow
}
}();