Jump to content


ENSASKE

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

Posts I've Made

In Topic: Recover original value of column after column callback

12 March 2019 - 07:21 PM

ohh I forgot, I found the answer.

 

You cannot retrieve the original value after you change it. 

 

I create an extra column on the grid "text_status" (not in database) and change that fictional column so you dont have to modify the original value of $row->status

$crud->columns('text_status');

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

Simple, but i didn't know about it. Hope this helps others because there is no documentation about it