I asked this on StackOverflow, but it might be better to ask here since this is the DataTables home forum. I hope this makes sense.
Simply listing the contents of a MySQL table in DataTables, using server side-processing (ssp.class.php) is no problem at all. Works like a charm and I want to stress the fact that this does not concern the function "ShippingMethod" nor how to use regular DataTables in general.
I want to have a column in the DataTable that does NOT have a corresponding column in the MySQL table, and I want to populate this column with computed values, that take other column values from the MySQL table as parameters, how do I do?
MySQL table:
Contains three columns. As you can see, there is NO column here for Shipping Method.
Name | PartnerID | Express
Abe | 23 | true
Eve | 47 | false
Joe | 47 | true
Pseudo-PHP function:
Returns a text-string containing shipping method, like "Plane", "Train" or "Automobile"
function ShippingMethod(PartnerID,Express) {
return $computedDataTextString
}
HTML DataTable:
As you can see, the column Shipping Method here does not correspond to any column in the MySQL table.
<thead>
<th>First Name</th>
<th>Shipping Method</th>
</thead>
Prepping data for ssp.class.php
This is where I run into trouble. How do I get the results of the PHP-function (i.e. Shipping Method) in here? And how would I go about prepping the array, since there is no table column for this data?
$columns = array(
array( 'db' => 'Name', 'dt' => 0 ),
array( 'db' => ???????, 'dt' => 1,