2013-07-02 165 views
0

我想突出显示特定字段中的文本Estado(州)目前有3个州,“activo”,“inactivo”和“pendiente”,当它与Pendiente相匹配时,我想突出显示文字将颜色改为红色,但不知道在哪里做相应的修改。在Grocery Crud中突出显示文本

我将图像附加到更好的视图。

enter image description here

由于事先

回答

1

它称为callback_column它将“处理”之前显示给用户它的列。

这里的例子

public function webpages() 
{ 
$c = new grocery_CRUD(); 
$c->set_table('status'); 
$c->columns('estado','email_propietario'); 
$c->callback_column('estado',array($this,'_callback_active_state')); 
$output = $c->render(); 
$this->_view_output($output); 
} 

public function _callback_active_state($value, $row) 
{ 
    if ($row->estado == 'pendiente'){ 
    return "<pre style='color:red'>".$row->estado."</pre>";} 
    else {return $row->estado;} 
} 
+1

非常感谢,正是我需要的。 –