Search code examples
codeigniter-2grocery-crud

highlight text in Grocery Crud


I'd like to highlight text in a specific field Estado(state) currently it has 3 states, "activo", "inactivo" and "pendiente" , when it matchs to pendiente i want to highlight the text changing the color to red, but no idea where to do the corresponding modifications.

I'm attaching an image to a better view.

enter image description here

thanks in advance


Solution

  • it called callback_column it will "process" the column before it shown to user.

    here's example

    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;}
    }