Get data from 2 columns of database in server-side script and render php code
Get data from 2 columns of database in server-side script and render php code

I would get data from 2 columns of my database into the array
This is the example in https://datatables.net/examples/server_side/simple.html
$columns = array(
array( 'db' => 'first_name', 'dt' => 0 ),
array( 'db' => 'last_name', 'dt' => 1 ),
array( 'db' => 'position', 'dt' => 2 ),
array( 'db' => 'office', 'dt' => 3 ),
array(
'db' => 'start_date',
'dt' => 4,
'formatter' => function( $d, $row ) {
return date( 'jS M y', strtotime($d));
}
),
array(
'db' => 'salary',
'dt' => 5,
'formatter' => function( $d, $row ) {
return '$'.number_format($d);
}
)
);
I would something like this:
array( 'db' => 'office', 'lastname', 'status' 'dt' => 3 ),
If this Is possibile then i would use this data in the formatter function to personalize the render of this column with php code alwais in the php server-side script
This discussion has been closed.
Replies
The best way of doing then when using the demo server-side processing script is to get the data for both columns independently, and then use a client-side renderer to combine them.
Sorting and filtering would only happen on one of the two data points, but anything else would require you to modify the demo script (feel free to if you so wish!).
Allan
Very thanks for reply, I'm trying the two solutions