YAHOO.widget.DataTable.Formatter.changeLight=function(elCell, oRecord, oColumn, oData){ elCell.innerHTML = "<img src=‘../MonitorManage/images/gray_lamp.png‘>"; }; {key:"ONLINESTATUS", label:"状态",width:30,resizeable:true,sortable:true,formatter:"changeLight"},
通过获取到行记录的id然后操作
var myTable = Map.realYUIDataTable; var recordsSet = myTable.getRecordSet(); var records = recordsSet.getRecords(); for(var s=0; s<records.length; s++){ var alarmStatusCell = records[s]._oData.ALARMSTATUS; var id = records[s].getId(); if(alarmStatusCell!="" && alarmStatusCell!="00000000000000000000000000000000" && alarmStatusCell!=null){ $("#"+id).attr(‘style‘,‘background:#FF9797;‘); }else{ $("#"+id).attr(‘style‘,‘‘); } }
yui--datatable 行添加格式,布布扣,bubuko.com
原文:http://www.cnblogs.com/wishyouhappy/p/3736755.html