Jump to content


ENSASKE

Member Since 01 Feb 2017
Offline Last Active Mar 12 2019 07:30 PM
-----

Topics I've Started

Recover original value of column after column callback

04 March 2019 - 06:57 PM

Hello, second time I ask something here.  :D

 

I have a problem, I use a callback column to change the value for the grid, but then I need it for another callback but the value is already changed, I need the original value.

 

Example:

 

Column called "status" comes from database where 1="open", 2="closed", etc (like 12 status)

$crud->callback_column('status', function ($value, $row){
    switch($row->status){
        case 1 : $text = 'open'; break;
        case 2 : $text = 'closed'; break;
        default : $text = $row->status; break;
    }
			
    return $text;
});

but then I have to use it in another callback:

$crud->add_action('Sumary', '', '', 'fa-file', function($primary_key , $row){    
    return "javascript:window.open('".base_url('Sumary/'.$row->status)."', '_blank');";
});

and the value of $row->status now is "closed" but I need the number "2", how to recover the original value?