2013-07-02 235 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

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