I cannot show you the querry but you can see here i add the columnMeta to all numbers type:"num-fmt", becouse it cannot be ordered correct if I change to "number":
->pipe(
new ColumnMeta(
array(
"nmb_rooms" => array(
"label" => "Nr. of Rooms",
"type" => "num-fmt",
),
"cc" => array(
"type" => "num-fmt",
),
"time_spent" => array(
"type" => "num-fmt",
),
"diff" => array(
"type" => "num-fmt",
),
"cc_formatted" => array(
"label" => "Expected time spent",
"type" => "string",
),
"time_spent_formatted" => array(
"label" => "Actual time spent",
"type" => "string",
),
"diff_formatted" => array(
"label" => "Time difference",
"type" => "string",
),
)
)
)
and here I create the Datatable inside a view
<?php
DataTables::create(
array(
"dataSource" => $this->dataStore("demo"),
"options" => array(
"searching" => true,
),
"columns" => array(
"nmb_rooms",
"cc_formatted" => array(
'data-order' => 'cc',
),
"time_spent_formatted" => array(
'data-order' => 'time_spent',
),
"diff_formatted" => array(
'data-order' => 'diff',
),
),
),
) ?>
"cc, time_spent, diff" is a number of total seconds between 2 dates and "diff_formatted, ..." are calculated columns which display the duration in hours and minutes as a string