【发布时间】:2018-01-31 07:13:41
【问题描述】:
//隐藏输入元素
//我的网格详情: $("#jqGrid").jqGrid({ url: '@Url.Action("EditedEventData", "Calendar" ,new{ })' + '?CountryId=' + @countryid + '&CityId=' + @cityid , 异步:真, 数据类型:“json”, col型号:[
//label: "Edit Actions",
name: "",
width: 100,
formatter: "actions",
formatoptions: {
keys: true,
edit: true,
add: true,
del: true,
editOptions: {},
addOptions: {},
delOptions: {
url:'@Url.Action("RemoveEvent", "Calendar")'+ '?HolidayId='+document.getElementById('hdnEventId').value ,
//mtype: 'POST',
}// **here it is showing hdnEventId value empty**
}
}
],
onSelectRow : function(id){
console.log('inside onSelectRow');
alert(id);
document.getElementById('hdnEventId').value=id;
alert(document.getElementById('hdnEventId').value);
},
sortname: 'EventDate',
loadonce: true,
width: 750,
height: 200,
rowNum: 150,
pager: "#jqGridPager"
});
我无法在 delOptions 操作方法中访问 onSelectRow 的 id。 所以想到了一个隐藏的 html 元素并存储该值,但它显示为空。 提前致谢
【问题讨论】:
-
您使用哪个版本的jqGrid以及来自哪个fork的jqGrid(free jqGrid,商业Guriddo jqGrid JS或版本中的旧jqGrid =4.7)? jqGrid 在删除过程中默认发送 rowid(与您在
onSelectRow中看到的相同),但在使用 POST 请求时它是 HTTP 正文的一部分,而不是 URL 的一部分。您可以使用 Chrome/IE/Firefox 的开发者工具查看 HTTP 网络流量。 -
我使用了 Guriddo jqGrid JS bt 问题是访问作为我的 eventId 的 id 以便传递给我的控制器方法
-
谁能帮帮我
标签: jqgrid