I have CGridview which consists of list of messages, I want to distinguish it by read and unread by color change in grid, I am not good in CSS so I don' t have any Idea about it?
最佳答案
在main.css中添加
.grid-view table.items tr.unread { background: none repeat scroll 0 0 #FF0000 !important; /* red color is unread */ } .grid-view table.items tr.read { background: none repeat scroll 0 0 #00FF00 !important; /* green color is read */ }
在消息模型中
function isRead() { return $this->hasRead; }
在 CGridView 中添加行 css 类表达式
'rowCssClassExpression' => '$data->isRead()?"read":"unread"',
关于php - 想根据表格中的某个字段显示CGridview,并在显示时区分它们?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12381084/