我尝试使用jqGrid和lib.web.mvc设置一个函数来获取特定的单元格值。我无法弄清楚如何实现这个目标......
我在JqGridHelper帮助程序定义中设置了以下内容。请注意问题所在的 onCellSelect:" getImageId" 属性。
<table id="fuelTickets" class="table">
@{
var grid = new JqGridHelper<FuelTktImgRetrievalMdl.ViewModels.HH_FuelTkt_Output>("FuelTickets",
dataType: JqGridDataTypes.Json,
methodType: JqGridMethodTypes.Post,
pager: true,
rowsNumber: 10,
sortingName: "FuelTkt_ID",
sortingOrder: JqGridSortingOrders.Asc,
viewRecords: true,
autoWidth: true,
gridView: true,
JqGridParametersNames.HH_FuelTkt_Input,
url: Url.Action("GetFilteredFuelTicketsAsync"),
caption: "Fuel Tickets",
onCellSelect: "getImageId",
emptyRecords: "No records to view"
);
}
</table>
我的功能在页面上的javascript中如下:
function getImageId(rowid, iCol, cellcontent) {
var grid = $('#fuelTickets');
var imageID = grid.jqGrid('getCell', rowid, 'Image_ID');
if (imageID != "")
DisplayReceipt(imageID);
}