簡體   English   中英

如何在jqgrid列中顯示圖像

[英]How to display an image in the column of jqgrid

我想在jqgrid列中顯示一張從“ / Index / CaseBatchDetailList”獲得的所有數據的圖像。 我有我的jquery,

 $(function () {
var outerwidth = $('#TableCaseDtlsView').width();
$("#CaseBatchDetailList").jqGrid({
    url: '/Index/CaseBatchDetailList',
    datatype: 'json',
    mtype: "GET",
    colNames: ["Serial Number", "Denomination", "Note Image", "Back Image"],
    colModel: [
                    { name: "serialno", sortable: true, width: "120px", align: "center" },
                    { name: "denomination", sortable: true, width: "120px", align: "left" },
                    {
                        name: "frontimageurl", sortable: false, width: "290px", align: "center", fixed: true,
                        formatter: function () {
                            return "<img src = /F:/MCP_Images/635101007551068098_324.jpg>";
                        }
                    },
                    {
                        name: "backimageurl", sortable: false, width: "290px", align: "center", fixed: true,
                        formatter: function () {
                            return "<img src = /F:/MCP_Images/635101007551068098_324.jpg>";
                        }
                    }
    ],
 ...
});

我只是嘗試了img src的示例。 我需要在不同的列中顯示不同的圖像。 作為初學者,我不知道該如何操作。請告訴我如何實現。

當我看到您的評論說圖像源在列表中時,在格式化程序中,您可以執行以下操作:

formatter: function (cellvalue, options, rowobject) {
    return "<img src='"+cellvalue+"'>";
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM