Hi,
i'm using Datables and the Dashboard. But i can't seem to get rowCallback to work. Maybe i put it in the wrong palce?
Here's my code, thanks for helping :
protected function onCreated()
{
$this
->use(\koolreport\datagrid\DataTables::class)
->settings([
"options"=>array(
"paging"=>true,
"searching"=>true,
"pageLength"=> 50,
),
"columns"=>array(
"product_name"=>array(
"label"=>"Product Name"
),
"_stock"=>array(
"label"=>"Current Stock"
),
"_qty"=>array(
"label"=>"Quantity sold"
),
"_line_total"=>array(
"label"=>"Sales Amount",
"type"=>"number",
"prefix"=>"$",
"decimals"=>2,
),
"_inc_product_status"=>array(
"label"=>"Status"
)),
"rowCallback"=> "function( row, data ) {
if ( data['_inc_product_status'] == 'Discontinued' ) {
$(row).addClass('yellow');
$(row).find('td').addClass('yellow');
}
else if ( data['_inc_product_status'] == 'DiscontinuedRA' ){
$(row).addClass('red');
$(row).find('td').addClass('red');
}
}"
]);
}