$("#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 + '" />'; }