2
I am using Datatable to generate a table where there is a Status field that receives values 1 or 2 and Status with value 1 is Active and 2 is Inactive. how do I show Active/Inactive instead of the number.
Try to do if Lse here to print the result but could not.
This snippet is where I array the Status: array( 'db' => 'status', 'dt' => 6),
Obs. db is the result that comes from the database and dt is the column in the datatable.
$columns = array(
array( 'db' => 'id', 'dt' => 0),
array( 'db' => 'empresa', 'dt' => 1),
array( 'db' => 'ar', 'dt' => 2),
array( 'db' => 'nf', 'dt' => 3),
array( 'db' => 'tp', 'dt' => 4),
array( 'db' => 'descricao', 'dt' => 5,
'formatter' => function( $d,$row ){
return substr (($d), 0, 46);
}
),
array( 'db' => 'status', 'dt' => 6),
array( 'db' => 'created','dt' => 7,
'formatter' => function( $d, $row ) {
return date( 'd-m-Y - H:i:s', strtotime($d));
}
),
array( 'db' => 'modified','dt' => 8,
'formatter' => function( $d, $row ) {
return date( 'd-m-Y - H:i:s', strtotime($d));
}
)
);
Thank you very much!
I couldn’t locate the Status column you commented on.
– Woss