yui--datatable 行添加格式
采用formatter
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"},
js操作
通过获取到行记录的id然后操作
var records = myTable.getRecordSet().getRecords(); var i, len,id; for(i=0,len=records .length; i<len; i++){ id = records[i].getId(); if(...){ $("#"+id).attr('style','background:#FF9797;'); } }