JqGrid自定义的列

$("#gridTable").jqGrid({
    //...其它属性
    colModel: [
            //...其它列
            { name: 'dsource_alarm', index: 'dsource_alarm',  30, align: "center", sortable: false, editable: false, formatter: alarmFormatter }
            
    ]
});
    
//自定义报警列格式
function alarmFormatter(cellvalue, options, rowdata)
{
    if (cellvalue != "0")
        return '<img class="alarmimg" src="../Images/128x128/RedLight.png" alt="' + cellvalue + '" />';
    else 
        return '<img class="alarmimg" src="../Images/128x128/GreenLight.png" alt="' + cellvalue + '" />';
}

来源:https://www.cnblogs.com/james641/p/5945486.html

原文地址:https://www.cnblogs.com/youmingkuang/p/8716727.html